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:
IntEnum
Custom model roles.
Note
Prior to QGIS 3.36 this was available as QgsLocatorModel.Role
Added in version 3.36.
ResultData
:QgsLocatorResult
dataAvailable as
QgsLocatorModel.ResultDataRole
in older QGIS releases.ResultType
: Result typeAvailable as
QgsLocatorModel.ResultTypeRole
in older QGIS releases.ResultFilterPriority
: Result priority, used byQgsLocatorProxyModel
for sorting roles.Available as
QgsLocatorModel.ResultFilterPriorityRole
in older QGIS releases.ResultScore
: Result match score, used byQgsLocatorProxyModel
for sorting roles.Available as
QgsLocatorModel.ResultScoreRole
in older QGIS releases.ResultFilterName
: Associated filter name which created the resultAvailable as
QgsLocatorModel.ResultFilterNameRole
in older QGIS releases.ResultFilterGroupSorting
: Custom value for sortingDeprecated since version 3.40.: No longer used.
Available as
QgsLocatorModel.ResultFilterGroupSortingRole
in older QGIS releases.ResultFilterGroupTitle
: Group titleResultFilterGroupScore
: Group scoreResultActions
: The actions to be shown for the given result in a context menuAvailable as
QgsLocatorModel.ResultActionsRole
in older QGIS releases.
- NoGroup = -1¶
- Role¶
alias of
CustomRole
- UnorderedGroup = 0¶
- addResult(self, result: QgsLocatorResult)[source]¶
Adds a new
result
to 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