Class: QgsVectorLayerFeatureCounter

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

Bases: qgis._core.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: Enums

Methods

childEvent

connectNotify

customEvent

disconnectNotify

featureCount

Returns the feature count for a particular legendKey.

featureIds

Returns the feature Ids for a particular legendKey.

finished

isCanceled

isSignalConnected

receivers

run

Calculates the feature count and Ids per symbol

sender

senderSignalIndex

setProgress

timerEvent

Signals

symbolsCounted

Emitted when the symbols have been counted.

Attributes

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

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

featureIds(self, symbolkey: str) → object

Returns the feature Ids for a particular legendKey. If the key has not been found an empty QSet will be returned.

New in version 3.10.

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

Calculates the feature count and Ids per symbol

sender()
senderSignalIndex()
setProgress()
symbolsCounted

Emitted when the symbols have been counted. [signal]

timerEvent()