Class: QgsLocatorModel

class qgis.core.QgsLocatorModel(parent: QObject = None)

Bases: PyQt5.QtCore.QAbstractTableModel

Constructor for QgsLocatorModel.

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.

New in version 3.0.

Parameters

parent

NoGroup = 9999
ResultActionsRole = 263
ResultDataRole = 257
ResultFilterGroupSortingRole = 262
ResultFilterNameRole = 261
ResultFilterPriorityRole = 259
ResultScoreRole = 260
ResultTypeRole = 258
class Role

Bases: int

addResult(self, result: QgsLocatorResult)

Adds a new result to the model.

Parameters

result (QgsLocatorResult) –

beginInsertColumns()
beginInsertRows()
beginMoveColumns()
beginMoveRows()
beginRemoveColumns()
beginRemoveRows()
beginResetModel()
changePersistentIndex()
changePersistentIndexList()
childEvent()
clear(self)

Resets the model and clears all existing results.

See also

deferredClear()

columnCount(self, parent: QModelIndex = QModelIndex()) → int
Parameters

parent (QModelIndex = QModelIndex()) –

Return type

int

connectNotify()
createIndex()
customEvent()
data(self, index: QModelIndex, role: int = Qt.DisplayRole) → Any
Parameters
  • index (QModelIndex) –

  • role (int = Qt.DisplayRole) –

Return type

Any

decodeData()
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 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()

disconnectNotify()
encodeData()
endInsertColumns()
endInsertRows()
endMoveColumns()
endMoveRows()
endRemoveColumns()
endRemoveRows()
endResetModel()
flags(self, index: QModelIndex) → Qt.ItemFlags
Parameters

index (QModelIndex) –

Return type

Qt.ItemFlags

isSignalConnected()
persistentIndexList()
receivers()
resetInternalData()
roleNames(self) → Dict[int, QByteArray]
Return type

Dict[int, QByteArray]

rowCount(self, parent: QModelIndex = QModelIndex()) → int
Parameters

parent (QModelIndex = QModelIndex()) –

Return type

int

sender()
senderSignalIndex()
timerEvent()