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.

New in version 3.0.

QgsLocatorModel(parent: QObject = None) Constructor for QgsLocatorModel.

Methods

addResult

Adds a new result to the model.

beginInsertColumns

beginInsertRows

beginMoveColumns

beginMoveRows

beginRemoveColumns

beginRemoveRows

beginResetModel

changePersistentIndex

changePersistentIndexList

childEvent

clear

Resets the model and clears all existing results.

columnCount

param parent

connectNotify

createIndex

customEvent

data

param index

decodeData

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).

disconnectNotify

encodeData

endInsertColumns

endInsertRows

endMoveColumns

endMoveRows

endRemoveColumns

endRemoveRows

endResetModel

flags

param index

isSignalConnected

persistentIndexList

receivers

resetInternalData

roleNames

rtype

Dict[int, QByteArray]

rowCount

param parent

sender

senderSignalIndex

timerEvent

Attributes

NoGroup

ResultActionsRole

ResultDataRole

ResultFilterGroupSortingRole

ResultFilterNameRole

ResultFilterPriorityRole

ResultScoreRole

ResultTypeRole

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) –

QgsLocatorModel.beginInsertColumns(self, QModelIndex, int, int)
QgsLocatorModel.beginInsertRows(self, QModelIndex, int, int)
QgsLocatorModel.beginMoveColumns(self, QModelIndex, int, int, QModelIndex, int) -> bool
QgsLocatorModel.beginMoveRows(self, QModelIndex, int, int, QModelIndex, int) -> bool
QgsLocatorModel.beginRemoveColumns(self, QModelIndex, int, int)
QgsLocatorModel.beginRemoveRows(self, QModelIndex, int, int)
beginResetModel(self)
QgsLocatorModel.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

deferredClear()

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

parent (QModelIndex = QModelIndex()) –

Return type

int

connectNotify(self, QMetaMethod)
QgsLocatorModel.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

QgsLocatorModel.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 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(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)