Class: QgsFeaturePickerModelBase

Provides a list of features based on filter conditions.

Features are fetched asynchronously.

Added in version 3.14.

Note

This is an abstract class, with methods which must be implemented by a subclass.

The following methods must be implemented: requestToReloadCurrentFeature(), setExtraIdentifierValueToNull()

Class Hierarchy

Inheritance diagram of qgis.core.QgsFeaturePickerModelBase

Base classes

QAbstractItemModel

QObject

Subclasses

QgsFeatureFilterModel

Provides a list of features based on filter conditions.

QgsFeaturePickerModel

Provides a list of features based on filter conditions.

class qgis.core.QgsFeaturePickerModelBase[source]

Bases: QAbstractItemModel

__init__(parent: QObject | None = None)

Create a new QgsFeaturePickerModelBase, optionally specifying a parent.

Parameters:

parent (Optional[QObject] = None)

class CustomRole(*values)

Bases: IntEnum

Extra roles that can be used to fetch data from this model.

Note

Prior to QGIS 3.36 this was available as QgsFeaturePickerModelBase.Role

Added in version 3.36.

  • IdentifierValue: Used to retrieve the identifier value (primary key) of a feature.

    Deprecated since version 3.40.: Use IdentifierValuesRole instead.

    Available as QgsFeaturePickerModelBase.IdentifierValueRole in older QGIS releases.

  • IdentifierValues: Used to retrieve the identifierValues (primary keys) of a feature.

    Available as QgsFeaturePickerModelBase.IdentifierValuesRole in older QGIS releases.

  • Value: Used to retrieve the displayExpression of a feature.

    Available as QgsFeaturePickerModelBase.ValueRole in older QGIS releases.

  • Feature: Used to retrieve the feature, it might be incomplete if the request doesn’t fetch all attributes or geometry.

    Available as QgsFeaturePickerModelBase.FeatureRole in older QGIS releases.

  • FeatureId: Used to retrieve the id of a feature.

    Available as QgsFeaturePickerModelBase.FeatureIdRole in older QGIS releases.

Role

alias of CustomRole

allowNull(self) bool[source]

Add a NULL entry to 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 beginUpdate[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.

displayExpression(self) str[source]

The display expression will be used for

  • displaying values in the combobox

  • filtering based on filterValue

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.

signal endUpdate[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 extraIdentifierValueChanged[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.

extraIdentifierValueIndex(self) int[source]

The index at which the extra identifier value is available within the model.

Return type:

int

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

extraValueDoesNotExist(self) bool[source]

Flag indicating that the extraIdentifierValue does not exist in the data.

Return type:

bool

signal extraValueDoesNotExistChanged[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 filter expression to apply, next to the filterValue. Can be used for spatial filtering etc.

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.

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

filterValue(self) str[source]

This value will be used to filter the features available from this model. Whenever a substring of the displayExpression of a feature matches the filter value, it will be accessible by this model.

Return type:

str

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

isLoading(self) bool[source]

Indicator if the model is currently performing any feature iteration in the background.

Return type:

bool

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

orderExpression(self) str[source]

The order expression will be used for sort values in the combobox.

Added in version 4.0.

Return type:

str

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

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]

Add a NULL entry to the list.

Parameters:

allowNull (bool)

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

The display expression will be used for

  • displaying values in the combobox

  • filtering based on filterValue

Parameters:

displayExpression (Optional[str])

abstract setExtraIdentifierValueToNull(self)[source]

Allows specifying one value that does not need to match the filter criteria but will still be available in the model as NULL value(s).

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 filter expression to apply, next to the filterValue. Can be used for spatial filtering etc.

Parameters:

filterExpression (Optional[str])

setFilterValue(self, filterValue: str | None)[source]

This value will be used to filter the features available from this model. Whenever a substring of the displayExpression of a feature matches the filter value, it will be accessible by this model.

Parameters:

filterValue (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)

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

The order expression will be used for sort values in 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 will be used for sort values in the combobox. Ascending or descending.

Added in version 4.0.

Parameters:

sortOrder (Qt.SortOrder)

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

The source layer from which features will be fetched.

Parameters:

sourceLayer (Optional[QgsVectorLayer])

sortOrder(self) Qt.SortOrder[source]

The order direction will be used for sort values in the combobox. Ascending or descending.

Added in version 4.0.

Return type:

Qt.SortOrder

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

sourceLayer(self) QgsVectorLayer | None[source]

The source layer from which features will be fetched.

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.