A QTreeView class based searcher.
More...
#include <QtxSearchTool.h>
|
| QModelIndexList | findItems (const QString &, QtxSearchTool *) |
| | Find all appropriate items. More...
|
| |
| QModelIndex | findNearest (const QModelIndex &, const QModelIndexList &, bool) |
| | Find model index from the list nearest to the specified index. More...
|
| |
| void | showItem (const QModelIndex &) |
| | Ensure the found item to become visible and selected. More...
|
| |
| QString | getId (const QModelIndex &) |
| | Get unique item ID. More...
|
| |
| int | compareIndices (const QModelIndex &, const QModelIndex &) |
| | Compare items. More...
|
| |
A QTreeView class based searcher.
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.
◆ QtxTreeViewSearcher()
| QtxTreeViewSearcher::QtxTreeViewSearcher |
( |
QTreeView * |
view, |
|
|
int |
col = 0 |
|
) |
| |
Constructor.
- Parameters
-
| view | tree view widget |
| col | column for which search to be performed (0 by default) |
- See also
- setSearchColumn()
◆ ~QtxTreeViewSearcher()
| QtxTreeViewSearcher::~QtxTreeViewSearcher |
( |
| ) |
|
|
virtual |
◆ compareIndices()
| int QtxTreeViewSearcher::compareIndices |
( |
const QModelIndex & |
left, |
|
|
const QModelIndex & |
right |
|
) |
| |
|
private |
Compare items.
- 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().
◆ find()
| bool QtxTreeViewSearcher::find |
( |
const QString & |
text, |
|
|
QtxSearchTool * |
st |
|
) |
| |
|
virtual |
◆ findFirst()
| bool QtxTreeViewSearcher::findFirst |
( |
const QString & |
text, |
|
|
QtxSearchTool * |
st |
|
) |
| |
|
virtual |
◆ findItems()
| QModelIndexList QtxTreeViewSearcher::findItems |
( |
const QString & |
text, |
|
|
QtxSearchTool * |
st |
|
) |
| |
|
private |
◆ findLast()
| bool QtxTreeViewSearcher::findLast |
( |
const QString & |
text, |
|
|
QtxSearchTool * |
st |
|
) |
| |
|
virtual |
◆ findNearest()
| QModelIndex QtxTreeViewSearcher::findNearest |
( |
const QModelIndex & |
index, |
|
|
const QModelIndexList & |
lst, |
|
|
bool |
direction |
|
) |
| |
|
private |
Find model index from the list nearest to the specified index.
- 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().
◆ findNext()
| bool QtxTreeViewSearcher::findNext |
( |
const QString & |
text, |
|
|
QtxSearchTool * |
st |
|
) |
| |
|
virtual |
◆ findPrevious()
| bool QtxTreeViewSearcher::findPrevious |
( |
const QString & |
text, |
|
|
QtxSearchTool * |
st |
|
) |
| |
|
virtual |
◆ getId()
| QString QtxTreeViewSearcher::getId |
( |
const QModelIndex & |
index | ) |
|
|
private |
Get unique item ID.
- Parameters
-
- Returns
- item ID
◆ matchFlags()
| Qt::MatchFlags QtxTreeViewSearcher::matchFlags |
( |
QtxSearchTool * |
st | ) |
const |
|
protectedvirtual |
◆ searchColumn()
| int QtxTreeViewSearcher::searchColumn |
( |
| ) |
const |
◆ setSearchColumn()
| void QtxTreeViewSearcher::setSearchColumn |
( |
int |
column | ) |
|
◆ showItem()
| void QtxTreeViewSearcher::showItem |
( |
const QModelIndex & |
index | ) |
|
|
private |
Ensure the found item to become visible and selected.
- Parameters
-
References myIndex, and myView.
◆ myColumn
| int QtxTreeViewSearcher::myColumn |
|
private |
◆ myIndex
| QPersistentModelIndex QtxTreeViewSearcher::myIndex |
|
private |
◆ myView
The documentation for this class was generated from the following files: