An abstract list model for displaying the results of locator searches.
More...
#include <qgslocatormodel.h>
|
| QgsLocatorModel (QObject *parent=nullptr) |
| Constructor for QgsLocatorModel. More...
|
|
void | clear () |
| Resets the model and clears all existing results. More...
|
|
int | columnCount (const QModelIndex &parent=QModelIndex()) const override |
|
QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const override |
|
void | deferredClear () |
| Resets the model and clears all existing results after a short delay, or whenever the next result is added to the model (whichever occurs first). More...
|
|
Qt::ItemFlags | flags (const QModelIndex &index) const override |
|
QHash< int, QByteArray > | roleNames () const override |
|
int | rowCount (const QModelIndex &parent=QModelIndex()) const override |
|
An abstract list model for displaying the results of locator searches.
Note that this class should generally be used with a QgsLocatorProxyModel in order to ensure correct sorting of results by priority and match level.
- Since
- QGIS 3.0
Definition at line 42 of file qgslocatormodel.h.
◆ Role
Custom model roles.
Enumerator |
---|
ResultDataRole | QgsLocatorResult data.
|
ResultTypeRole | Result type.
|
ResultFilterPriorityRole | Result priority, used by QgsLocatorProxyModel for sorting roles.
|
ResultScoreRole | Result match score, used by QgsLocatorProxyModel for sorting roles.
|
ResultFilterNameRole | Associated filter name which created the result.
|
ResultFilterGroupSortingRole | Group results within the same filter results.
|
ResultActionsRole | The actions to be shown for the given result in a context menu.
|
Definition at line 51 of file qgslocatormodel.h.
◆ QgsLocatorModel()
QgsLocatorModel::QgsLocatorModel |
( |
QObject * |
parent = nullptr | ) |
|
◆ addResult
◆ clear()
void QgsLocatorModel::clear |
( |
| ) |
|
◆ columnCount()
int QgsLocatorModel::columnCount |
( |
const QModelIndex & |
parent = QModelIndex() | ) |
const |
|
override |
◆ data()
QVariant QgsLocatorModel::data |
( |
const QModelIndex & |
index, |
|
|
int |
role = Qt::DisplayRole |
|
) |
| const |
|
override |
◆ deferredClear()
void QgsLocatorModel::deferredClear |
( |
| ) |
|
Resets the model and clears all existing results after a short delay, or whenever the next result is added to the model (whichever occurs first).
Using deferredClear() instead of clear() can avoid the visually distracting frequent clears which may occur if the model is being updated quickly multiple times as a result of users typing in a search query.
- See also
- deferredClear()
Definition at line 50 of file qgslocatormodel.cpp.
◆ flags()
Qt::ItemFlags QgsLocatorModel::flags |
( |
const QModelIndex & |
index | ) |
const |
|
override |
◆ roleNames()
QHash< int, QByteArray > QgsLocatorModel::roleNames |
( |
| ) |
const |
|
override |
◆ rowCount()
int QgsLocatorModel::rowCount |
( |
const QModelIndex & |
parent = QModelIndex() | ) |
const |
|
override |
◆ NoGroup
const int QgsLocatorModel::NoGroup = 9999 |
|
static |
The documentation for this class was generated from the following files: