Class: QgsFeatureFilterProvider

Abstract interface for use by classes that filter the features or attributes of a layer.

A QgsFeatureFilterProvider provides a method for modifying a QgsFeatureRequest in place to apply additional filters to the request, since QGIS 3.18 a method to filter allowed attributes is also available.

Note

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

The following methods must be implemented: clone(), filterFeatures(), layerAttributes()

Class Hierarchy

Inheritance diagram of qgis.core.QgsFeatureFilterProvider

Subclasses

QgsAccessControl

A helper class that centralizes restrictions given by all the access control filter plugins.

QgsFeatureFilter

A feature filter provider allowing to set filter expressions on a per-layer basis.

QgsFeatureFilterProviderGroup

A filter filter provider grouping several filter providers.

Abstract Methods

clone

Create a clone of the feature filter provider

filterFeatures

Add additional filters to the feature request to further restrict the features returned by the request.

layerAttributes

Returns the list of visible attribute names from a list of attributes names for the given layer

class qgis.core.QgsFeatureFilterProvider[source]

Bases: object

abstract clone(self) QgsFeatureFilterProvider | None[source]

Create a clone of the feature filter provider

Return type:

Optional[QgsFeatureFilterProvider]

Returns:

a new clone

abstract filterFeatures(self, layer: QgsVectorLayer | None, featureRequest: QgsFeatureRequest)[source]

Add additional filters to the feature request to further restrict the features returned by the request. Derived classes must implement this method.

Parameters:
abstract layerAttributes(self, layer: QgsVectorLayer | None, attributes: Iterable[str | None]) List[str][source]

Returns the list of visible attribute names from a list of attributes names for the given layer

Added in version 3.18.

Parameters:
  • layer (Optional[QgsVectorLayer])

  • attributes (Iterable[Optional[str]])

Return type:

List[str]