Class: QgsLocatorAutomaticModel

class qgis.core.QgsLocatorAutomaticModel(locator: QgsLocator)

Bases: QgsLocatorModel

Constructor for QgsLocatorAutomaticModel, linked with the specified locator.

The locator is used as the model’s parent.

A QgsLocatorModel which has is associated directly with a QgsLocator, and is automatically populated with results from locator searches.

Use this QgsLocatorModel subclass when you want the connections between a QgsLocator and the model to be automatically created for you. If more flexibility in model behavior is required, use the base QgsLocatorModel class instead and setup the connections manually.

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

locator

QgsLocatorAutomaticModel.beginInsertColumns(self, QModelIndex, int, int)
QgsLocatorAutomaticModel.beginInsertRows(self, QModelIndex, int, int)
QgsLocatorAutomaticModel.beginMoveColumns(self, QModelIndex, int, int, QModelIndex, int) -> bool
QgsLocatorAutomaticModel.beginMoveRows(self, QModelIndex, int, int, QModelIndex, int) -> bool
QgsLocatorAutomaticModel.beginRemoveColumns(self, QModelIndex, int, int)
QgsLocatorAutomaticModel.beginRemoveRows(self, QModelIndex, int, int)
beginResetModel(self)
QgsLocatorAutomaticModel.changePersistentIndex(self, QModelIndex, QModelIndex)
changePersistentIndexList(self, Iterable[QModelIndex], Iterable[QModelIndex])
childEvent(self, QChildEvent)
connectNotify(self, QMetaMethod)
createContext(self)QgsLocatorContext

Returns a new locator context for searches. The default implementation returns a default constructed QgsLocatorContext. Subclasses can override this method to implement custom context creation logic.

Return type

QgsLocatorContext

QgsLocatorAutomaticModel.createIndex(self, int, int, object: object = 0) -> QModelIndex
customEvent(self, QEvent)
QgsLocatorAutomaticModel.decodeData(self, int, int, QModelIndex, QDataStream) -> bool
disconnectNotify(self, QMetaMethod)
encodeData(self, Iterable[QModelIndex], QDataStream)
endInsertColumns(self)
endInsertRows(self)
endMoveColumns(self)
endMoveRows(self)
endRemoveColumns(self)
endRemoveRows(self)
endResetModel(self)
isSignalConnected(self, QMetaMethod) → bool
locator(self)QgsLocator

Returns a pointer to the locator utilized by this model.

Return type

QgsLocator

persistentIndexList(self) → List[QModelIndex]
receivers(self, PYQT_SIGNAL) → int
resetInternalData(self)
search(self, string: str)

Enqueues a search for a specified string within the model.

Note that the search may not begin immediately if an existing search request is still running. In this case the existing search must be completely terminated before the new search can begin. The model handles this situation automatically, and will trigger a search for the new search string as soon as possible.

Parameters

string (str) –

sender(self) → QObject
senderSignalIndex(self) → int
timerEvent(self, QTimerEvent)