Class: QgsVectorLayerEditBufferGroup

class qgis.core.QgsVectorLayerEditBufferGroup

Bases: PyQt5.QtCore.QObject

The edit buffer group manages a group of edit buffers. Commands like commit and rollback are managed by the group invokes individual addFeature(), deleteFeature(), … in the correct order across all contained edit buffers.

New in version 3.26.

QgsVectorLayerEditBufferGroup(parent: QObject = None) Constructor for QgsEditBufferGroup

Methods

addLayer

Add a layer to this edit buffer group.

childEvent

clear

Remove all layers from this edit buffer group

commitChanges

Attempts to commit any changes to disk.

connectNotify

customEvent

disconnectNotify

isEditing

Returns True if the layers are in editing mode

isSignalConnected

layers

Gets the set of layers currently managed by this edit buffer group.

modifiedLayers

Gets the set of modified layers currently managed by this edit buffer group.

receivers

rollBack

Stop editing and discard the edits

sender

senderSignalIndex

startEditing

Start editing

timerEvent

addLayer(self, layer: QgsVectorLayer)

Add a layer to this edit buffer group.

Parameters

layer (QgsVectorLayer) –

childEvent(self, QChildEvent)
clear(self)

Remove all layers from this edit buffer group

commitChanges(self, stopEditing: bool = True) Tuple[bool, List[str]]

Attempts to commit any changes to disk. Returns the result of the attempt. If a commit fails, the in-memory changes are left alone.

This allows editing to continue if the commit failed on e.g. a disallowed value in a Postgres database - the user can re-edit and try again.

The commits occur in distinct stages, (add attributes, add features, change attribute values, change geometries, delete features, delete attributes) so if a stage fails, it’s difficult to roll back cleanly. Therefore any error message also includes which stage failed so that the user has some chance of repairing the damage cleanly.

Parameters

stopEditing (bool = True) – if set to False, the layer will stay in editing mode. Otherwise the layer editing mode will be disabled if the commit is successful.

Return type

Tuple[bool, List[str]]

Returns

  • True on success

  • commitErrors: will be set to a list of descriptive errors if the commit fails.

connectNotify(self, QMetaMethod)
customEvent(self, QEvent)
disconnectNotify(self, QMetaMethod)
isEditing(self) bool

Returns True if the layers are in editing mode

Return type

bool

isSignalConnected(self, QMetaMethod) bool
layers(self) Set[QgsVectorLayer]

Gets the set of layers currently managed by this edit buffer group.

Return type

Set[QgsVectorLayer]

Returns

Layer set

modifiedLayers(self) Set[QgsVectorLayer]

Gets the set of modified layers currently managed by this edit buffer group.

Return type

Set[QgsVectorLayer]

Returns

Layer set

receivers(self, PYQT_SIGNAL) int
rollBack(self, stopEditing: bool = True) Tuple[bool, List[str]]

Stop editing and discard the edits

Parameters

stopEditing (bool = True) – if set to False, the layer will stay in editing mode. Otherwise the layer editing mode will be disabled if the rollback is successful.

Return type

Tuple[bool, List[str]]

Returns

  • False if errors occurred during rollback

  • rollbackErrors: will be set to a list of descriptive errors if the rollback fails.

sender(self) QObject
senderSignalIndex(self) int
startEditing(self) bool

Start editing

Return type

bool

Returns

True on success

timerEvent(self, QTimerEvent)