Class: QgsFeaturePickerWidget

This offers a combobox with autocompleter that allows selecting features from a layer.

It will show up to 100 entries at a time. The entries can be chosen based on the displayExpression and whenever text is typed into the combobox, the completer and popup will adjust to features matching the typed text.

Added in version 3.14.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsFeaturePickerWidget

Base classes

QWidget

QObject

QPaintDevice

class qgis.gui.QgsFeaturePickerWidget[source]

Bases: QWidget

__init__(parent: QWidget | None = None)

Create a new QgsFeaturePickerWidget, optionally specifying a parent.

Parameters:

parent (Optional[QWidget] = None)

allowNull(self) bool[source]

Determines if a NULL value should be available in the list.

Return type:

bool

signal allowNullChanged[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.

currentModelIndex(self) QModelIndex[source]

The index of the currently selected item.

Return type:

QModelIndex

displayExpression(self) str[source]

The display expression will be used to display features as well as the value to match the typed text against.

Return type:

str

signal displayExpressionChanged[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.

feature(self) QgsFeature[source]

Returns the current feature

Return type:

QgsFeature

signal featureChanged[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.

fetchGeometry(self) bool[source]

Returns if the geometry is fetched

Return type:

bool

signal fetchGeometryChanged[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.

fetchLimit(self) int[source]

Returns the feature request fetch limit

Return type:

int

signal fetchLimitChanged[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.

filterExpression(self) str[source]

An additional expression to further restrict the available features. This can be used to integrate additional spatial or other constraints.

Return type:

str

signal filterExpressionChanged[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.

layer(self) QgsVectorLayer | None[source]

The layer from which features should be listed.

Return type:

Optional[QgsVectorLayer]

signal layerChanged[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.

signal modelUpdated[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.

nullIndex(self) int[source]

Returns the current index of the NULL value, or -1 if NULL values are not allowed.

Return type:

int

setAllowNull(self, allowNull: bool)[source]

Determines if a NULL value should be available in the list.

Parameters:

allowNull (bool)

setDisplayExpression(self, displayExpression: str | None)[source]

The display expression will be used to display features as well as the value to match the typed text against.

Parameters:

displayExpression (Optional[str])

setFeature(self, featureId: int)[source]

Sets the current index by using the given feature

Parameters:

featureId (int)

setFetchGeometry(self, fetchGeometry: bool)[source]

Defines if the geometry will be fetched

Parameters:

fetchGeometry (bool)

setFetchLimit(self, fetchLimit: int)[source]

Defines the feature request fetch limit If set to 0, no limit is applied when fetching

Parameters:

fetchLimit (int)

setFilterExpression(self, filterExpression: str | None)[source]

An additional expression to further restrict the available features. This can be used to integrate additional spatial or other constraints.

Parameters:

filterExpression (Optional[str])

setLayer(self, layer: QgsVectorLayer | None)[source]

The layer from which features should be listed.

Parameters:

layer (Optional[QgsVectorLayer])

setShowBrowserButtons(self, showBrowserButtons: bool)[source]

Defines if the browsing buttons are shown

Note

Buttons are browsing the currently fetched features. If a limit is set, there might be more features to be fetched from the layer.

Parameters:

showBrowserButtons (bool)

showBrowserButtons(self) bool[source]

Returns if the browsing buttons are shown

Return type:

bool

signal showBrowserButtonsChanged[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.