A search target (for KLFSearchBar) for standard item views. More...
#include <klfitemviewsearchtarget.h>
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) |
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);
Definition at line 60 of file klfitemviewsearchtarget.h.
KLFItemViewSearchTarget::KLFItemViewSearchTarget | ( | QAbstractItemView * | view, |
QObject * | parent = NULL |
||
) |
Definition at line 130 of file klfitemviewsearchtarget.cpp.
References KLF_INIT_PRIVATE, and setSearchView().
KLFItemViewSearchTarget::~KLFItemViewSearchTarget | ( | ) | [virtual] |
Definition at line 136 of file klfitemviewsearchtarget.cpp.
References KLF_DELETE_PRIVATE.
void KLFItemViewSearchTarget::searchAborted | ( | ) | [virtual] |
Reimplemented from KLFIteratorSearchable< QModelIndex >.
Definition at line 212 of file klfitemviewsearchtarget.cpp.
References KLF_DEBUG_BLOCK, and KLF_FUNC_NAME.
QList< int > KLFItemViewSearchTarget::searchColumns | ( | ) |
Definition at line 146 of file klfitemviewsearchtarget.cpp.
QModelIndex KLFItemViewSearchTarget::searchIterAdvance | ( | const QModelIndex & | pos, |
bool | forward | ||
) | [virtual] |
Implements KLFIteratorSearchable< QModelIndex >.
Definition at line 154 of file klfitemviewsearchtarget.cpp.
QModelIndex KLFItemViewSearchTarget::searchIterBegin | ( | ) | [virtual] |
Implements KLFIteratorSearchable< QModelIndex >.
Definition at line 161 of file klfitemviewsearchtarget.cpp.
QModelIndex KLFItemViewSearchTarget::searchIterEnd | ( | ) | [virtual] |
Implements KLFIteratorSearchable< QModelIndex >.
Definition at line 165 of file klfitemviewsearchtarget.cpp.
bool KLFItemViewSearchTarget::searchIterMatches | ( | const QModelIndex & | pos, |
const QString & | queryString | ||
) | [virtual] |
Implements KLFIteratorSearchable< QModelIndex >.
Definition at line 169 of file klfitemviewsearchtarget.cpp.
References QModelIndex::data(), KLF_DEBUG_BLOCK, KLF_FUNC_NAME, QList::size(), and QVariant::toString().
void KLFItemViewSearchTarget::searchMoveToIterPos | ( | const QModelIndex & | pos | ) | [virtual] |
Reimplemented from KLFIteratorSearchable< QModelIndex >.
Definition at line 227 of file klfitemviewsearchtarget.cpp.
References KLF_ASSERT_NOT_NULL, KLF_DEBUG_BLOCK, and KLF_FUNC_NAME.
void KLFItemViewSearchTarget::searchPerformed | ( | const QModelIndex & | resultMatchPosition, |
bool | found, | ||
const QString & | queryString | ||
) | [virtual] |
Reimplemented from KLFIteratorSearchable< QModelIndex >.
Definition at line 177 of file klfitemviewsearchtarget.cpp.
References KLF_ASSERT_NOT_NULL, KLF_DEBUG_BLOCK, and KLF_FUNC_NAME.
void KLFItemViewSearchTarget::searchReinitialized | ( | ) | [virtual] |
Reimplemented from KLFPosSearchable.
Definition at line 219 of file klfitemviewsearchtarget.cpp.
References KLF_DEBUG_BLOCK, and KLF_FUNC_NAME.
void KLFItemViewSearchTarget::setSearchColumns | ( | const QList< int > & | columnList | ) |
Definition at line 248 of file klfitemviewsearchtarget.cpp.
References QAbstractItemModel::columnCount(), KLF_ASSERT_NOT_NULL, KLF_DEBUG_BLOCK, KLF_FUNC_NAME, and QList::toSet().
Referenced by setSearchView().
void KLFItemViewSearchTarget::setSearchView | ( | QAbstractItemView * | view | ) |
Definition at line 236 of file klfitemviewsearchtarget.cpp.
References KLF_DEBUG_BLOCK, KLF_FUNC_NAME, setSearchColumns(), and view().
Referenced by KLFItemViewSearchTarget().
QAbstractItemView * KLFItemViewSearchTarget::view | ( | ) |
Definition at line 142 of file klfitemviewsearchtarget.cpp.
Referenced by setSearchView().