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]

QgsFeatureFilterModel.beginInsertColumns(self, QModelIndex, int, int)
QgsFeatureFilterModel.beginInsertRows(self, QModelIndex, int, int)
QgsFeatureFilterModel.beginMoveColumns(self, QModelIndex, int, int, QModelIndex, int) -> bool
QgsFeatureFilterModel.beginMoveRows(self, QModelIndex, int, int, QModelIndex, int) -> bool
QgsFeatureFilterModel.beginRemoveColumns(self, QModelIndex, int, int)
QgsFeatureFilterModel.beginRemoveRows(self, QModelIndex, int, int)
beginResetModel(self)
beginUpdate

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

QgsFeatureFilterModel.changePersistentIndex(self, QModelIndex, QModelIndex)
changePersistentIndexList(self, Iterable[QModelIndex], Iterable[QModelIndex])
childEvent(self, QChildEvent)
columnCount(self, parent: QModelIndex) → int
Parameters

parent (QModelIndex) –

Return type

int

connectNotify(self, QMetaMethod)
QgsFeatureFilterModel.createIndex(self, int, int, object: object = 0) -> QModelIndex
customEvent(self, QEvent)
data(self, index: QModelIndex, role: int) → Any
Parameters
  • index (QModelIndex) –

  • role (int) –

Return type

Any

QgsFeatureFilterModel.decodeData(self, int, int, QModelIndex, QDataStream) -> bool
disconnectNotify(self, QMetaMethod)
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(self, Iterable[QModelIndex], QDataStream)
endInsertColumns(self)
endInsertRows(self)
endMoveColumns(self)
endMoveRows(self)
endRemoveColumns(self)
endRemoveRows(self)
endResetModel(self)
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(self, QMetaMethod) → bool
parent(self, child: QModelIndex) → QModelIndex
Parameters

child (QModelIndex) –

Return type

QModelIndex

persistentIndexList(self) → List[QModelIndex]
receivers(self, PYQT_SIGNAL) → int
resetInternalData(self)
rowCount(self, parent: QModelIndex) → int
Parameters

parent (QModelIndex) –

Return type

int

sender(self) → QObject
senderSignalIndex(self) → int
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(self, QTimerEvent)