Class: QgsVectorLayerFeatureCounter

class qgis.core.QgsVectorLayerFeatureCounter(layer: QgsVectorLayer, context: QgsExpressionContext = QgsExpressionContext())

Bases: QgsTask

Create a new feature counter for layer.

Counts the features in a QgsVectorLayer in task. You should most likely not use this directly and instead call QgsVectorLayer.countSymbolFeatures() and connect to the signal QgsVectorLayer.symbolFeatureCountMapChanged()

New in version 3.0.

Parameters
childEvent()
connectNotify()
customEvent()
disconnectNotify()
featureCount(self, legendKey: str) → int

Gets the feature count for a particular legendKey. If the key has not been found, -1 will be returned.

Parameters

legendKey (str) –

Return type

int

finished()
isCanceled()
isSignalConnected()
receivers()
run(self) → bool
Return type

bool

sender()
senderSignalIndex()
setProgress()
symbolsCounted

Emitted when the symbols have been counted. [signal]

timerEvent()