Class: QgsLocatorResult

Encapsulates properties of an individual matching result found by a QgsLocatorFilter.

Methods

setUserData

Set userData for the locator result

Attributes

actions

Additional actions to be used in a locator widget for the given result.

description

Descriptive text for result.

displayString

String displayed for result.

filter

Filter from which the result was obtained.

group

Group the results by categories If left as empty string, this means that results are all shown without being grouped.

groupScore

Specifies the score of the group to allow ordering.

icon

Icon for result.

score

Match score, from 0 - 1, where 1 represents a perfect match.

class qgis.core.QgsLocatorResult[source]

Bases: object

__init__()
__init__(filter: QgsLocatorFilter | None, displayString: str | None, userData: Any = None)

Constructor for QgsLocatorResult.

Parameters:
  • filter (Optional[QgsLocatorFilter])

  • displayString (Optional[str])

  • userData (Any = None)

__init__(a0: QgsLocatorResult)
Parameters:

a0 (QgsLocatorResult)

class ResultAction

Bases: object

The ResultAction stores basic information for additional actions to be used in a locator widget for the result. They could be used in a context menu for instance.

Added in version 3.6.

iconPath
id
text
actions: List[QgsLocatorResult.ResultAction]

Additional actions to be used in a locator widget for the given result. They could be displayed in a context menu.

Added in version 3.6.

description: str

Descriptive text for result.

displayString: str

String displayed for result.

filter: QgsLocatorFilter

Filter from which the result was obtained. This is automatically set.

group: str

Group the results by categories If left as empty string, this means that results are all shown without being grouped. If a group is given, the results will be grouped by group under a header.

Note

This should be translated.

Added in version 3.2.

groupScore: float

Specifies the score of the group to allow ordering. Score must be positive, higher scores are shown first. If the scores are left to 0 or are identical, the sorting of groups is made alphabetically.

Added in version 3.40.

icon: QIcon

Icon for result.

score: float

Match score, from 0 - 1, where 1 represents a perfect match.

setUserData(self, userData: Any)[source]

Set userData for the locator result

Added in version 3.34.

Parameters:

userData (Any)

property userData[source]

Returns the userData.

Added in version 3.18.

Return type:

Any