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.

Enums

CustomRole

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

Role

alias of CustomRole

Abstract Methods

setExtraIdentifierValueToNull

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

Methods

allowNull

Add a NULL entry to the list.

displayExpression

The display expression will be used for

extraIdentifierValueIndex

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

extraValueDoesNotExist

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

fetchGeometry

Returns if the geometry is fetched

fetchLimit

Returns the feature request fetch limit

filterExpression

An additional filter expression to apply, next to the filterValue.

filterValue

This value will be used to filter the features available from this model.

formFeature

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

isLoading

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

parentFormFeature

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

setAllowNull

Add a NULL entry to the list.

setDisplayExpression

The display expression will be used for

setFetchGeometry

Defines if the geometry will be fetched

setFetchLimit

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

setFilterExpression

An additional filter expression to apply, next to the filterValue.

setFilterValue

This value will be used to filter the features available from this model.

setFormFeature

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

setParentFormFeature

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

setSourceLayer

The source layer from which features will be fetched.

sourceLayer

The source layer from which features will be fetched.

Signals

allowNullChanged

Add a NULL entry to the list.

beginUpdate

Notification that the model is about to be changed because a job was completed.

currentFeatureChanged

Emitted when the current feature in the model has changed This emitted both when the extra value changes and when the extra value status changes.

displayExpressionChanged

The display expression will be used for

endUpdate

Notification that the model change is finished.

extraIdentifierValueChanged

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

extraIdentifierValueIndexChanged

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

extraValueDoesNotExistChanged

Notification whether the model has found a feature tied to the extraIdentifierValue or not.

fetchGeometryChanged

Emitted when the fetching of the geometry changes

fetchLimitChanged

Emitted when the fetching limit for the feature request changes

filterExpressionChanged

An additional filter expression to apply, next to the filterValue.

filterJobCompleted

Indicates that a filter job has been completed and new data may be available.

filterValueChanged

This value will be used to filter the features available from this model.

formFeatureChanged

An attribute form feature to be used alongside the filter expression.

isLoadingChanged

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

parentFormFeatureChanged

A parent attribute form feature to be used alongside the filter expression.

sourceLayerChanged

The source layer from which features will be fetched.

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]

Add a NULL entry to the list.

signal beginUpdate[source]

Notification that the model is about to be changed because a job was completed.

signal currentFeatureChanged[source]

Emitted when the current feature in the model has changed This emitted both when the extra value changes and when the extra value status changes. It allows being notified when the feature is fetched after the extra value has been set.

Added in version 3.16.5.

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]

The display expression will be used for

  • displaying values in the combobox

  • filtering based on filterValue

signal endUpdate[source]

Notification that the model change is finished. Will always be emitted in sync with beginUpdate.

signal extraIdentifierValueChanged[source]

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

extraIdentifierValueIndex(self) int[source]

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

Return type:

int

signal extraIdentifierValueIndexChanged(index: int)[source]

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

Parameters:

index (int)

extraValueDoesNotExist(self) bool[source]

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

Return type:

bool

signal extraValueDoesNotExistChanged(found: bool)[source]

Notification whether the model has found a feature tied to the extraIdentifierValue or not.

Parameters:

found (bool)

fetchGeometry(self) bool[source]

Returns if the geometry is fetched

Return type:

bool

signal fetchGeometryChanged[source]

Emitted when the fetching of the geometry changes

fetchLimit(self) int[source]

Returns the feature request fetch limit

Return type:

int

signal fetchLimitChanged[source]

Emitted when the fetching limit for the feature request changes

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]

An additional filter expression to apply, next to the filterValue. Can be used for spatial filtering etc.

signal filterJobCompleted[source]

Indicates that a filter job has been completed and new data may be available.

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]

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.

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]

An attribute form feature to be used alongside the filter expression.

Added in version 3.42.2.

isLoading(self) bool[source]

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

Return type:

bool

signal isLoadingChanged[source]

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

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]

A parent attribute form feature to be used alongside the filter expression.

Added in version 3.42.2.

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)

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)

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

The source layer from which features will be fetched.

Parameters:

sourceLayer (Optional[QgsVectorLayer])

sourceLayer(self) QgsVectorLayer | None[source]

The source layer from which features will be fetched.

Return type:

Optional[QgsVectorLayer]

signal sourceLayerChanged[source]

The source layer from which features will be fetched.