Class: QgsVectorLayerFeatureCounter¶
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().
Class Hierarchy¶
Base classes¶
Abstract base class for long running background tasks. |
|
- class qgis.core.QgsVectorLayerFeatureCounter[source]¶
Bases:
QgsTask- __init__(layer: QgsVectorLayer | None, context: QgsExpressionContext = QgsExpressionContext(), storeSymbolFids: bool = False)
Create a new feature counter for
layer.- Parameters:
layer (Optional[QgsVectorLayer]) – Target
QgsVectorLayerto perform counting on.context (
QgsExpressionContext= QgsExpressionContext()) – SpecificQgsExpressionContextto use during the rendering step.storeSymbolFids (bool = False) – If
Truewill store the feature ids (fids), otherwise will only count the number of features per symbol. DefaultFalse.
- featureCount(self, legendKey: str | None) int¶
Returns the feature count for a particular
legendKey. If the key has not been found, -1 will be returned.- Parameters:
legendKey (Optional[str])
- Return type:
int
- featureIds(self, symbolkey: str | None) Any[source]¶
Returns the feature Ids for a particular
legendKey. If the key has not been found an empty QSet will be returned.Added in version 3.10.
- Parameters:
symbolkey (Optional[str])
- Return type:
- signal symbolsCounted[source]¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.