Class: QgsLocatorAutomaticModel¶
A QgsLocatorModel
which 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.
Class Hierarchy¶
Base classes¶
An abstract list model for displaying the results of locator searches. |
|
Methods
Returns a pointer to the locator utilized by this model. |
|
Enqueues a search for a specified string within the model. |
Virtual Methods
In PyQGIS, only methods marked as virtual
can be safely overridden in a Python subclass of QgsLocatorAutomaticModel. See the FAQ for more details.
Returns a new locator context for searches. |
- class qgis.core.QgsLocatorAutomaticModel[source]¶
Bases:
QgsLocatorModel
- __init__(locator: QgsLocator | None)
Constructor for QgsLocatorAutomaticModel, linked with the specified
locator
.The
locator
is used as the model’s parent.- Parameters:
locator (Optional[QgsLocator])
- virtual createContext(self) QgsLocatorContext [source]¶
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:
- locator(self) QgsLocator | None [source]¶
Returns a pointer to the locator utilized by this model.
- Return type:
Optional[QgsLocator]
- search(self, string: str | None)[source]¶
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 (Optional[str])