Class: QgsLocatorWidget

A special locator widget which allows searching for matching results from a QgsLocator and presenting them to users for selection.

See also

QgsLocator

Class Hierarchy

Inheritance diagram of qgis.gui.QgsLocatorWidget

Base classes

QWidget

QObject

QPaintDevice

Methods

invalidateResults

Invalidates the current search results, e.g. as a result of changes to the locator filter settings.

locator

Returns a pointer to the locator utilized by this widget.

search

Triggers the locator widget to focus, open and start searching for a specified string.

setMapCanvas

Sets a map canvas to associate with the widget.

setPlaceholderText

Set placeholder text for the line edit.

setResultContainerAnchors

Sets the result container anchorPoint and anchorWidgetPoint position.

Signals

configTriggered

Emitted when the configure option is triggered in the widget.

class qgis.gui.QgsLocatorWidget[source]

Bases: QWidget

__init__(parent: QWidget | None = None)

Constructor for QgsLocatorWidget.

Parameters:

parent (Optional[QWidget] = None)

signal configTriggered[source]

Emitted when the configure option is triggered in the widget.

invalidateResults(self)[source]

Invalidates the current search results, e.g. as a result of changes to the locator filter settings.

locator(self) QgsLocator | None[source]

Returns a pointer to the locator utilized by this widget.

Return type:

Optional[QgsLocator]

search(self, string: str | None)[source]

Triggers the locator widget to focus, open and start searching for a specified string.

Parameters:

string (Optional[str])

setMapCanvas(self, canvas: QgsMapCanvas | None)[source]

Sets a map canvas to associate with the widget. This allows the widget to customize the searches performed by its locator(), such as prioritizing results which are near the current canvas extent.

Parameters:

canvas (Optional[QgsMapCanvas])

setPlaceholderText(self, text: str | None)[source]

Set placeholder text for the line edit.

Added in version 3.36.

Parameters:

text (Optional[str])

setResultContainerAnchors(self, anchorPoint: QgsFloatingWidget.AnchorPoint, anchorWidgetPoint: QgsFloatingWidget.AnchorPoint)[source]

Sets the result container anchorPoint and anchorWidgetPoint position.

Added in version 3.36.

Parameters: