A QTreeView class based searcher.
More...
#include <QtxSearchTool.h>
Public Member Functions |
| | QtxTreeViewSearcher (QTreeView *, int=0) |
| | Constructor.
|
| virtual | ~QtxTreeViewSearcher () |
| | Destructor.
|
| int | searchColumn () const |
| | Get column for which search is performed.
|
| void | setSearchColumn (int) |
| | Set column for which search should be performed.
|
| virtual bool | find (const QString &, QtxSearchTool *) |
| | Start new search.
|
| virtual bool | findNext (const QString &, QtxSearchTool *) |
| | Search next appropriate item.
|
| virtual bool | findPrevious (const QString &, QtxSearchTool *) |
| | Search previous appropriate item.
|
| virtual bool | findFirst (const QString &, QtxSearchTool *) |
| | Search first appropriate item.
|
| virtual bool | findLast (const QString &, QtxSearchTool *) |
| | Search last appropriate item.
|
Protected Member Functions |
| virtual Qt::MatchFlags | matchFlags (QtxSearchTool *) const |
| | Get match flags to be used by the searcher.
|
Private Member Functions |
| QModelIndexList | findItems (const QString &, QtxSearchTool *) |
| | Find all appropriate items.
|
| QModelIndex | findNearest (const QModelIndex &, const QModelIndexList &, bool) |
| | Find model index from the list nearest to the specified index.
|
| void | showItem (const QModelIndex &) |
| | Ensure the found item to become visible and selected.
|
| QString | getId (const QModelIndex &) |
| | Get unique item ID.
|
| int | compareIndices (const QModelIndex &, const QModelIndex &) |
| | Compare items.
|
Private Attributes |
| QTreeView * | myView |
| int | myColumn |
| QPersistentModelIndex | myIndex |
Detailed Description
The class QtxTreeViewSearcher can be used to find the items in the QTreeView widget.
The column for which data should be searched can be get/set with the searchColumn(), setSearchColumn() methods. By default, column 0 is used.
Constructor & Destructor Documentation
| QtxTreeViewSearcher::QtxTreeViewSearcher |
( |
QTreeView * |
view, |
|
|
int |
col = 0 |
|
) |
| |
- Parameters:
-
| view | tree view widget |
| col | column for which search to be performed (0 by default) |
- See also:
- setSearchColumn()
| QtxTreeViewSearcher::~QtxTreeViewSearcher |
( |
| ) |
[virtual] |
Member Function Documentation
| int QtxTreeViewSearcher::searchColumn |
( |
| ) |
const |
| void QtxTreeViewSearcher::setSearchColumn |
( |
int |
column | ) |
|
| bool QtxTreeViewSearcher::find |
( |
const QString & |
text, |
|
|
QtxSearchTool * |
st |
|
) |
| [virtual] |
| bool QtxTreeViewSearcher::findNext |
( |
const QString & |
text, |
|
|
QtxSearchTool * |
st |
|
) |
| [virtual] |
| bool QtxTreeViewSearcher::findPrevious |
( |
const QString & |
text, |
|
|
QtxSearchTool * |
st |
|
) |
| [virtual] |
| bool QtxTreeViewSearcher::findFirst |
( |
const QString & |
text, |
|
|
QtxSearchTool * |
st |
|
) |
| [virtual] |
| bool QtxTreeViewSearcher::findLast |
( |
const QString & |
text, |
|
|
QtxSearchTool * |
st |
|
) |
| [virtual] |
| Qt::MatchFlags QtxTreeViewSearcher::matchFlags |
( |
QtxSearchTool * |
st | ) |
const [protected, virtual] |
| QModelIndexList QtxTreeViewSearcher::findItems |
( |
const QString & |
text, |
|
|
QtxSearchTool * |
st |
|
) |
| [private] |
| QModelIndex QtxTreeViewSearcher::findNearest |
( |
const QModelIndex & |
index, |
|
|
const QModelIndexList & |
lst, |
|
|
bool |
direction |
|
) |
| [private] |
- Parameters:
-
| index | model index for which a nearest item is searched |
| lst | list of model indices |
| direction | if true find next appropriate item, otherwise find privious appropriate item |
References compareIndices().
| void QtxTreeViewSearcher::showItem |
( |
const QModelIndex & |
index | ) |
[private] |
| QString QtxTreeViewSearcher::getId |
( |
const QModelIndex & |
index | ) |
[private] |
- Parameters:
-
- Returns:
- item ID
| int QtxTreeViewSearcher::compareIndices |
( |
const QModelIndex & |
left, |
|
|
const QModelIndex & |
right |
|
) |
| [private] |
- Parameters:
-
| left | first model index to be compared |
| right | last model index to be compared |
- Returns:
- 0 if items are equal, negative value if left item is less than right one and positive value otherwise
References getId().
Field Documentation