Class: QgsFeatureFilterModel

class qgis.core.QgsFeatureFilterModel(parent: QObject = None)

Bases: PyQt5.QtCore.QAbstractItemModel

Create a new QgsFeatureFilterModel, optionally specifying a parent.

Provides a list of features based on filter conditions. Features are fetched asynchronously.

New in version 3.0.

Parameters

parent

IdentifierValueRole = 256
IdentifierValuesRole = 257
class Role

Bases: int

ValueRole = 258
allowNull(self) → bool

Add a NULL entry to the list.

Return type

bool

allowNullChanged

Add a NULL entry to the list. [signal]

beginInsertColumns()
beginInsertRows()
beginMoveColumns()
beginMoveRows()
beginRemoveColumns()
beginRemoveRows()
beginResetModel()
beginUpdate

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

changePersistentIndex()
changePersistentIndexList()
childEvent()
columnCount(self, parent: QModelIndex) → int
Parameters

parent (QModelIndex) –

Return type

int

connectNotify()
createIndex()
customEvent()
data(self, index: QModelIndex, role: int) → Any
Parameters
  • index (QModelIndex) –

  • role (int) –

Return type

Any

decodeData()
disconnectNotify()
displayExpression(self) → str

The display expression will be used for

  • displaying values in the combobox

  • filtering based on filterValue

Return type

str

displayExpressionChanged

The display expression will be used for

  • displaying values in the combobox

  • filtering based on filterValue [signal]

encodeData()
endInsertColumns()
endInsertRows()
endMoveColumns()
endMoveRows()
endRemoveColumns()
endRemoveRows()
endResetModel()
endUpdate

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

extraIdentifierValue(self) → Any

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

Deprecated since version QGIS: 3.10

Return type

Any

extraIdentifierValueChanged

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

extraIdentifierValueIndex(self) → int

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

Return type

int

extraIdentifierValueIndexChanged

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

Parameters

index (int) –

extraIdentifierValues(self) → List[Any]

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

New in version 3.10.

Return type

List[Any]

extraValueDoesNotExist(self) → bool

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

Return type

bool

extraValueDoesNotExistChanged

Flag indicating that the extraIdentifierValue does not exist in the data. [signal]

filterExpression(self) → str

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

Return type

str

filterExpressionChanged

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

filterJobCompleted

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

filterValue(self) → str

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

filterValueChanged

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

identifierField(self) → str

The identifier field should be a unique field that can be used to identify individual features. It is normally set to the primary key of the layer. If there are several identifier fields defined, the behavior is not guaranteed

Deprecated since version QGIS: 3.10 use identifierFields instead

Return type

str

identifierFieldChanged

The identifier field should be a unique field that can be used to identify individual features. It is normally set to the primary key of the layer. [signal]

identifierFields(self) → List[str]

The identifier field should be a unique field that can be used to identify individual features. It is normally set to the primary key of the layer.

New in version 3.10.

Return type

List[str]

index(self, row: int, column: int, parent: QModelIndex) → QModelIndex
Parameters
  • row (int) –

  • column (int) –

  • parent (QModelIndex) –

Return type

QModelIndex

isLoading(self) → bool

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

Return type

bool

isLoadingChanged

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

isSignalConnected()
parent(self, child: QModelIndex) → QModelIndex
Parameters

child (QModelIndex) –

Return type

QModelIndex

persistentIndexList()
receivers()
resetInternalData()
rowCount(self, parent: QModelIndex) → int
Parameters

parent (QModelIndex) –

Return type

int

sender()
senderSignalIndex()
setAllowNull(self, allowNull: bool)

Add a NULL entry to the list.

Parameters

allowNull (bool) –

setDisplayExpression(self, displayExpression: str)

The display expression will be used for

  • displaying values in the combobox

  • filtering based on filterValue

Parameters

displayExpression (str) –

setExtraIdentifierValue(self, extraIdentifierValue: Any)

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

Deprecated since version QGIS: 3.10

Parameters

extraIdentifierValue (Any) –

setExtraIdentifierValues(self, extraIdentifierValues: Iterable[Any])

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

New in version 3.10.

Parameters

extraIdentifierValues (Iterable[Any]) –

setExtraIdentifierValuesToNull(self)

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

New in version 3.10.

setFilterExpression(self, filterExpression: str)

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

Parameters

filterExpression (str) –

setFilterValue(self, filterValue: str)

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 (str) –

setIdentifierField(self, identifierField: str)

The identifier field should be a unique field that can be used to identify individual features. It is normally set to the primary key of the layer.

Deprecated since version QGIS: 3.10

Parameters

identifierField (str) –

setIdentifierFields(self, identifierFields: Iterable[str])

The identifier field should be a unique field that can be used to identify individual features. It is normally set to the primary key of the layer.

Note

This will also reset identifier fields to NULL

New in version 3.10.

Parameters

identifierFields (Iterable[str]) –

setSourceLayer(self, sourceLayer: QgsVectorLayer)

The source layer from which features will be fetched.

Parameters

sourceLayer (QgsVectorLayer) –

sourceLayer(self) → QgsVectorLayer

The source layer from which features will be fetched.

Return type

QgsVectorLayer

sourceLayerChanged

The source layer from which features will be fetched. [signal]

timerEvent()