Class: QgsTrackedVectorLayerTools

Vector layer tools subclass which “tracks” edits.

Class Hierarchy

Inheritance diagram of qgis.core.QgsTrackedVectorLayerTools

Base classes

QgsVectorLayerTools

Used to handle basic editing operations on vector layers.

QObject

class qgis.core.QgsTrackedVectorLayerTools[source]

Bases: QgsVectorLayerTools

virtual addFeatureV2(self, layer: QgsVectorLayer | None, defaultValues: Dict[int, Any], defaultGeometry: QgsGeometry, context: QgsVectorLayerToolsContext)[source]

This method calls the addFeature method of the backend QgsVectorLayerTools

Parameters:
  • layer (Optional[QgsVectorLayer]) – The layer to which the feature should be added

  • defaultValues (Dict[int, Any]) – Default values for the feature to add

  • defaultGeometry (QgsGeometry) – A default geometry to add to the feature

  • context (QgsVectorLayerToolsContext) -> (bool) – A context object to be used for e.g. to calculate feature expression-based values (since QGIS 3.38)

Returns:

  • True in case of success, False if the operation failed/was aborted

  • feature: A pointer to the feature

rollback(self)[source]

Delete all features which have been added via this object.

setVectorLayerTools(self, tools: QgsVectorLayerTools | None)[source]

Set the vector layer tools that will be used to interact with the data

Parameters:

tools (Optional[QgsVectorLayerTools])