Class: 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.
Class Hierarchy¶
Base classes¶
Subclasses¶
A |
Enums
Custom model roles. |
|
alias of |
Methods
Adds a new result to the model. |
|
Resets the model and clears all existing results. |
|
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). |
Attributes
- class qgis.core.QgsLocatorModel[source]¶
Bases:
QAbstractTableModel- __init__(parent: QObject | None = None)
Constructor for QgsLocatorModel.
- Parameters:
parent (Optional[QObject] = None)
- class CustomRole(*values)¶
Bases:
IntEnumCustom model roles.
Note
Prior to QGIS 3.36 this was available as QgsLocatorModel.Role
Added in version 3.36.
ResultData:QgsLocatorResultdataAvailable as
QgsLocatorModel.ResultDataRolein older QGIS releases.ResultType: Result typeAvailable as
QgsLocatorModel.ResultTypeRolein older QGIS releases.ResultFilterPriority: Result priority, used byQgsLocatorProxyModelfor sorting roles.Available as
QgsLocatorModel.ResultFilterPriorityRolein older QGIS releases.ResultScore: Result match score, used byQgsLocatorProxyModelfor sorting roles.Available as
QgsLocatorModel.ResultScoreRolein older QGIS releases.ResultFilterName: Associated filter name which created the resultAvailable as
QgsLocatorModel.ResultFilterNameRolein older QGIS releases.ResultFilterGroupSorting: Custom value for sortingDeprecated since version 3.40.: No longer used.
Available as
QgsLocatorModel.ResultFilterGroupSortingRolein older QGIS releases.ResultFilterGroupTitle: Group titleResultFilterGroupScore: Group scoreResultActions: The actions to be shown for the given result in a context menuAvailable as
QgsLocatorModel.ResultActionsRolein older QGIS releases.
- NoGroup = -1¶
- Role¶
alias of
CustomRole
- UnorderedGroup = 0¶
- addResult(self, result: QgsLocatorResult)[source]¶
Adds a new
resultto the model.- Parameters:
result (QgsLocatorResult)
- deferredClear(self)[source]¶
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 ofclear()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