[KLF Backend][KLF Tools][KLF Home]
KLatexFormula Project
Public Member Functions | List of all members
KLFItemViewSearchTarget Class Reference

A search target (for KLFSearchBar) for standard item views. More...

#include <klfitemviewsearchtarget.h>

Inheritance diagram for KLFItemViewSearchTarget:
Inheritance graph
[legend]
Collaboration diagram for KLFItemViewSearchTarget:
Collaboration graph
[legend]

Public Member Functions

 KLFItemViewSearchTarget (QAbstractItemView *view, QObject *parent=NULL)
 
virtual ~KLFItemViewSearchTarget ()
 
QAbstractItemView * view ()
 
QList< int > searchColumns ()
 
virtual QModelIndex searchIterAdvance (const QModelIndex &pos, bool forward)
 
virtual QModelIndex searchIterBegin ()
 
virtual QModelIndex searchIterEnd ()
 
virtual bool searchIterMatches (const QModelIndex &pos, const QString &queryString)
 
virtual void searchPerformed (const QModelIndex &resultMatchPosition, bool found, const QString &queryString)
 
virtual void searchAborted ()
 
virtual void searchReinitialized ()
 
virtual void searchMoveToIterPos (const QModelIndex &pos)
 
void setSearchView (QAbstractItemView *view)
 
void setSearchColumns (const QList< int > &columnList)
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
virtual ~QObject ()
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
virtual const QMetaObjectmetaObject () const
 
QString objectName () const
 
void setObjectName (const QString &name)
 
bool isWidgetType () const
 
bool isWindowType () const
 
bool signalsBlocked () const
 
bool blockSignals (bool block)
 
QThreadthread () const
 
void moveToThread (QThread *targetThread)
 
int startTimer (int interval, Qt::TimerType timerType)
 
void killTimer (int id)
 
findChild (const QString &name, Qt::FindChildOptions options) const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const
 
const QObjectList & children () const
 
void setParent (QObject *parent)
 
void installEventFilter (QObject *filterObj)
 
void removeEventFilter (QObject *obj)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const
 
bool disconnect (const QObject *receiver, const char *method) const
 
void dumpObjectTree ()
 
void dumpObjectInfo ()
 
bool setProperty (const char *name, const QVariant &value)
 
QVariant property (const char *name) const
 
QList< QByteArraydynamicPropertyNames () const
 
void destroyed (QObject *obj)
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const
 
bool inherits (const char *className) const
 
void deleteLater ()
 
- Public Member Functions inherited from KLFIteratorSearchable< QModelIndex >
 KLFIteratorSearchable ()
 
virtual ~KLFIteratorSearchable ()
 
SearchIterator searchIterNext (const SearchIterator &pos)
 
SearchIterator searchIterPrev (const SearchIterator &pos)
 
virtual SearchIterator searchIterStartFrom (bool forward)
 
virtual void searchPerformed (const SearchIterator &resultMatchPosition)
 
virtual void searchPerformed (const QString &queryString, bool found, const Pos &pos)
 
virtual Pos searchStartFrom (bool forward)
 
virtual void searchMoveToPos (const Pos &pos)
 
virtual SearchIterator searchIterFind (const SearchIterator &startPos, const QString &queryString, bool forward)
 Find occurence of a search string. More...
 
virtual SearchIterator searchIterFindNext (bool forward)
 Find the next occurence of previous search string. More...
 
virtual Pos searchFind (const QString &queryString, const Pos &fromPos, bool forward)
 
SearchIterator searchAdvanceIteratorSafe (const SearchIterator &it, int n=1)
 
SearchIterator searchAdvanceIteratorCycle (const SearchIterator &it, int n=1, bool skipEnd=false)
 
- Public Member Functions inherited from KLFPosSearchable
virtual QString searchQueryString () const
 The current query string. More...
 
virtual void setSearchQueryString (const QString &s)
 
virtual bool searchHasInterruptRequested ()
 
virtual void setSearchInterruptRequested (bool on)
 
- Public Member Functions inherited from KLFTarget
 KLFTarget ()
 
virtual ~KLFTarget ()
 

Additional Inherited Members

- Public Types inherited from KLFIteratorSearchable< QModelIndex >
typedef QModelIndex SearchIterator
 
- Static Public Member Functions inherited from QObject
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
- Protected Member Functions inherited from QObject
QObjectsender () const
 
int senderSignalIndex () const
 
int receivers (const char *signal) const
 
bool isSignalConnected (const QMetaMethod &signal) const
 
virtual void timerEvent (QTimerEvent *event)
 
virtual void childEvent (QChildEvent *event)
 
virtual void customEvent (QEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
- Protected Member Functions inherited from KLFIteratorSearchable< QModelIndex >
SearchIterator searchCurrentIterPos () const
 
- Protected Attributes inherited from KLFTarget
QList< KLFTargeter * > pTargetOf
 
- Properties inherited from QObject
 objectName
 

Detailed Description

A search target (for KLFSearchBar) for standard item views.

Add search functionality to standard item views. Any item view you may have (QTreeView/QListView etc.) may be added search functionality with KLFSearchBar, using this class as search target.

For basic usage, you should not need to interact more with this class than simply instantiating it and feeding it to KLFSearchBar as the search target with KLFSearchBar::setSearchTarget().

Matches are displayed in highlighted red font, and current found item is displayed as selected.

Minimal example:

QTableView * view = ...;
KLFSearchBar * searchBar = new KLFSearchBar(...);
KLFItemViewSearchTarget * searchTarget = new KLFItemViewSearchTarget(view, this);
searchBar->setSearchTarget(searchTarget);
Todo:
Currently, to highlight search matches this class replaces the delegate with a custom delegate used to highlight search matches, thus relying on the fact that the default delegate is close to a standard QItemDelegate. TODO: define some "proxy" delegate, and just extend the delegate that is already set on the view.

Definition at line 60 of file klfitemviewsearchtarget.h.

Constructor & Destructor Documentation

◆ KLFItemViewSearchTarget()

KLFItemViewSearchTarget::KLFItemViewSearchTarget ( QAbstractItemView *  view,
QObject parent = NULL 
)

Definition at line 130 of file klfitemviewsearchtarget.cpp.

References KLF_INIT_PRIVATE, and setSearchView().

◆ ~KLFItemViewSearchTarget()

KLFItemViewSearchTarget::~KLFItemViewSearchTarget ( )
virtual

Definition at line 136 of file klfitemviewsearchtarget.cpp.

References KLF_DELETE_PRIVATE.

Member Function Documentation

◆ searchAborted()

void KLFItemViewSearchTarget::searchAborted ( )
virtual

◆ searchColumns()

QList< int > KLFItemViewSearchTarget::searchColumns ( )

Definition at line 146 of file klfitemviewsearchtarget.cpp.

◆ searchIterAdvance()

QModelIndex KLFItemViewSearchTarget::searchIterAdvance ( const QModelIndex pos,
bool  forward 
)
virtual

Implements KLFIteratorSearchable< QModelIndex >.

Definition at line 154 of file klfitemviewsearchtarget.cpp.

◆ searchIterBegin()

QModelIndex KLFItemViewSearchTarget::searchIterBegin ( )
virtual

Implements KLFIteratorSearchable< QModelIndex >.

Definition at line 161 of file klfitemviewsearchtarget.cpp.

◆ searchIterEnd()

QModelIndex KLFItemViewSearchTarget::searchIterEnd ( )
virtual

Implements KLFIteratorSearchable< QModelIndex >.

Definition at line 165 of file klfitemviewsearchtarget.cpp.

◆ searchIterMatches()

bool KLFItemViewSearchTarget::searchIterMatches ( const QModelIndex pos,
const QString queryString 
)
virtual

◆ searchMoveToIterPos()

void KLFItemViewSearchTarget::searchMoveToIterPos ( const QModelIndex pos)
virtual

◆ searchPerformed()

void KLFItemViewSearchTarget::searchPerformed ( const QModelIndex resultMatchPosition,
bool  found,
const QString queryString 
)
virtual

◆ searchReinitialized()

void KLFItemViewSearchTarget::searchReinitialized ( )
virtual

◆ setSearchColumns()

void KLFItemViewSearchTarget::setSearchColumns ( const QList< int > &  columnList)

◆ setSearchView()

void KLFItemViewSearchTarget::setSearchView ( QAbstractItemView *  view)

◆ view()

QAbstractItemView * KLFItemViewSearchTarget::view ( )

Definition at line 142 of file klfitemviewsearchtarget.cpp.

Referenced by setSearchView().


The documentation for this class was generated from the following files:

Generated by doxygen 1.8.13