Class: QgsLocatorAutomaticModel

class qgis.core.QgsLocatorAutomaticModel

Bases: QgsLocatorModel

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.

QgsLocatorAutomaticModel(locator: Optional[QgsLocator]) Constructor for QgsLocatorAutomaticModel, linked with the specified locator.

The locator is used as the model’s parent.

beginInsertColumns(self, parent: QModelIndex, first: int, last: int)
beginInsertRows(self, parent: QModelIndex, first: int, last: int)
beginMoveColumns(self, sourceParent: QModelIndex, sourceFirst: int, sourceLast: int, destinationParent: QModelIndex, destinationColumn: int) bool
beginMoveRows(self, sourceParent: QModelIndex, sourceFirst: int, sourceLast: int, destinationParent: QModelIndex, destinationRow: int) bool
beginRemoveColumns(self, parent: QModelIndex, first: int, last: int)
beginRemoveRows(self, parent: QModelIndex, first: int, last: int)
changePersistentIndex(self, from_: QModelIndex, to: QModelIndex)
changePersistentIndexList(self, from_: Iterable[QModelIndex], to: Iterable[QModelIndex])
childEvent(self, a0: QChildEvent | None)
connectNotify(self, signal: 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:


createIndex(self, row: int, column: int, object: Any = None) QModelIndex
customEvent(self, a0: QEvent | None)
decodeData(self, row: int, column: int, parent: QModelIndex, stream: QDataStream) bool
disconnectNotify(self, signal: QMetaMethod)
encodeData(self, indexes: Iterable[QModelIndex], stream: QDataStream)
isSignalConnected(self, signal: QMetaMethod) bool
locator(self) QgsLocator | None

Returns a pointer to the locator utilized by this model.

Return type:


persistentIndexList(self) List[QModelIndex]
receivers(self, signal: PYQT_SIGNAL) int
search(self, string: str | None)

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.


string (Optional[str])

sender(self) QObject | None
senderSignalIndex(self) int
timerEvent(self, a0: QTimerEvent | None)