Class: QgsFeatureListComboBox

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.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsFeatureListComboBox

Base classes

QComboBox

QWidget

QObject

QPaintDevice

class qgis.gui.QgsFeatureListComboBox[source]

Bases: QComboBox

__init__(parent: QWidget | None = None)

Create a new QgsFeatureListComboBox, 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.

signal currentFeatureChanged[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 currentFeatureFoundChanged[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.

currentFeatureRequest(self) QgsFeatureRequest[source]

Shorthand for getting a feature request to query the currently selected feature.

Return type:

QgsFeatureRequest

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.

fetchLimit(self) int[source]

Returns the feature request fetch limit

Added in version 3.32.

Return type:

int

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.

formFeature(self) QgsFeature[source]

Returns an attribute form feature to be used with the filter expression.

Added in version 3.42.2.

Return type:

QgsFeature

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

identifierField(self) str[source]

Field name that will be used to uniquely identify the current feature. Normally the primary key of the layer.

Deprecated since version 3.10.

Return type:

str

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

identifierFields(self) List[str][source]

Field name that will be used to uniquely identify the current feature. Normally the primary key of the layer.

Added in version 3.10.

Return type:

List[str]

identifierValue(self) Any[source]

The identifier value of the currently selected feature. A value from the identifierField.

Deprecated since version 3.10.

Return type:

Any

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

identifierValues(self) List[Any][source]

The identifier values of the currently selected feature. A value from the identifierField.

Added in version 3.10.

Return type:

List[Any]

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.

Added in version 3.2.

Return type:

int

orderExpression(self) str[source]

The order expression of the model. It is used to evaluate sort values of the combobox.

Added in version 4.0.

Return type:

str

parentFormFeature(self) QgsFeature[source]

Returns a parent attribute form feature to be used with the filter expression.

Added in version 3.42.2.

Return type:

QgsFeature

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

setAllowNull(self, allowNull: bool)[source]

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

Parameters:

allowNull (bool)

setCurrentFeature(self, feature: QgsFeature)[source]

Sets the current index by using the given feature

Added in version 3.10.

Parameters:

feature (QgsFeature)

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])

setFetchLimit(self, fetchLimit: int)[source]

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

Added in version 3.32.

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])

setFormFeature(self, feature: QgsFeature)[source]

Sets an attribute form feature to be used with the filter expression.

Added in version 3.42.2.

Parameters:

feature (QgsFeature)

setIdentifierField(self, identifierField: str | None)[source]

Field name that will be used to uniquely identify the current feature. Normally the primary key of the layer.

Deprecated since version 3.10.

Parameters:

identifierField (Optional[str])

setIdentifierFields(self, identifierFields: Iterable[str | None])[source]

Field name that will be used to uniquely identify the current feature. Normally the primary key of the layer.

Added in version 3.10.

Parameters:

identifierFields (Iterable[Optional[str]])

setIdentifierValue(self, identifierValue: Any)[source]

The identifier value of the currently selected feature. A value from the identifierField.

Deprecated since version 3.10: Use setIdentifierValues.

Parameters:

identifierValue (Any)

setIdentifierValues(self, identifierValues: Iterable[Any])[source]

The identifier values of the currently selected feature. A value from the identifierFields.

Added in version 3.10.

Parameters:

identifierValues (Iterable[Any])

setIdentifierValuesToNull(self)[source]

Sets the identifier values of the currently selected feature to NULL value(s).

Added in version 3.10.

setOrderExpression(self, orderExpression: str | None)[source]

The order expression of the model. It is used to evaluate sort values of the combobox.

Added in version 4.0.

Parameters:

orderExpression (Optional[str])

setParentFormFeature(self, feature: QgsFeature)[source]

Sets a parent attribute form feature to be used with the filter expression.

Added in version 3.42.2.

Parameters:

feature (QgsFeature)

setSortOrder(self, sortOrder: Qt.SortOrder)[source]

The order direction of the model. It defines the direction on sorting the combobox as ascending or descending.

Added in version 4.0.

Parameters:

sortOrder (Qt.SortOrder)

setSourceLayer(self, sourceLayer: QgsVectorLayer | None)[source]

The layer from which features should be listed.

Parameters:

sourceLayer (Optional[QgsVectorLayer])

sortOrder(self) Qt.SortOrder[source]

The order direction of the model. It defines the direction on sorting the combobox as ascending or descending.

Added in version 4.0.

Return type:

Qt.SortOrder

sourceLayer(self) QgsVectorLayer | None[source]

The layer from which features should be listed.

Return type:

Optional[QgsVectorLayer]

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