Class: QgsLocatorModel¶
- class qgis.core.QgsLocatorModel¶
Bases:
PyQt5.QtCore.QAbstractTableModel
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.QgsLocatorModel(parent: QObject = None) Constructor for QgsLocatorModel.
Enums
Bases:
enum.IntEnum
alias of
CustomRole
Methods
Adds a new
result
to the model.Resets the model and clears all existing results.
- param parent:
- param index:
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).
- param index:
- rtype:
Dict[int, QByteArray]
- param parent:
Attributes
- class CustomRole(value)¶
Bases:
enum.IntEnum
Custom model roles.
Note
Prior to QGIS 3.36 this was available as QgsLocatorModel.Role
New in version 3.36.
ResultDataRole
:QgsLocatorResult
dataResultTypeRole
: Result typeResultFilterPriorityRole
: Result priority, used byQgsLocatorProxyModel
for sorting roles.ResultScoreRole
: Result match score, used byQgsLocatorProxyModel
for sorting roles.ResultFilterNameRole
: Associated filter name which created the resultResultFilterGroupSortingRole
: Group results within the same filter resultsResultActionsRole
: The actions to be shown for the given result in a context menu
- baseClass¶
alias of
QgsLocatorModel
- NoGroup = 9999¶
- Role¶
alias of
CustomRole
- addResult(self, result: QgsLocatorResult)¶
Adds a new
result
to the model.- Parameters:
result (QgsLocatorResult) –
- beginInsertColumns(self, QModelIndex, int, int)¶
- beginInsertRows(self, QModelIndex, int, int)¶
- beginMoveColumns(self, QModelIndex, int, int, QModelIndex, int) bool ¶
- beginMoveRows(self, QModelIndex, int, int, QModelIndex, int) bool ¶
- beginRemoveColumns(self, QModelIndex, int, int)¶
- beginRemoveRows(self, QModelIndex, int, int)¶
- beginResetModel(self)¶
- changePersistentIndex(self, QModelIndex, QModelIndex)¶
- changePersistentIndexList(self, Iterable[QModelIndex], Iterable[QModelIndex])¶
- childEvent(self, QChildEvent)¶
- clear(self)¶
Resets the model and clears all existing results.
See also
- columnCount(self, parent: QModelIndex = QModelIndex()) int ¶
- Parameters:
parent (QModelIndex = QModelIndex()) –
- Return type:
int
- connectNotify(self, QMetaMethod)¶
- createIndex(self, int, int, object: object = 0) QModelIndex ¶
- customEvent(self, QEvent)¶
- data(self, index: QModelIndex, role: int = Qt.DisplayRole) Any ¶
- Parameters:
index (QModelIndex) –
role (int = Qt.DisplayRole) –
- Return type:
Any
- decodeData(self, int, int, QModelIndex, QDataStream) bool ¶
- deferredClear(self)¶
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 ofclear()
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
- disconnectNotify(self, QMetaMethod)¶
- encodeData(self, Iterable[QModelIndex], QDataStream)¶
- endInsertColumns(self)¶
- endInsertRows(self)¶
- endMoveColumns(self)¶
- endMoveRows(self)¶
- endRemoveColumns(self)¶
- endRemoveRows(self)¶
- endResetModel(self)¶
- flags(self, index: QModelIndex) Qt.ItemFlags ¶
- Parameters:
index (QModelIndex) –
- Return type:
Qt.ItemFlags
- isSignalConnected(self, QMetaMethod) bool ¶
- persistentIndexList(self) List[QModelIndex] ¶
- receivers(self, PYQT_SIGNAL) int ¶
- resetInternalData(self)¶
- roleNames(self) Dict[int, QByteArray] ¶
- Return type:
Dict[int, QByteArray]
- rowCount(self, parent: QModelIndex = QModelIndex()) int ¶
- Parameters:
parent (QModelIndex = QModelIndex()) –
- Return type:
int
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- timerEvent(self, QTimerEvent)¶