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

class qgis.gui.QgsLocatorWidget[source]

Bases: QWidget

__init__(parent: QWidget | None = None)

Constructor for QgsLocatorWidget.

Parameters:

parent (Optional[QWidget] = None)

signal configTriggered[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

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: