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, commitErrors: Iterable[str], stopEditing: bool = True) bool

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.

Return type

bool

Returns

True on success

Parameters
  • commitErrors (Iterable[str]) –

  • stopEditing (bool = True) –

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, rollbackErrors: Iterable[str], stopEditing: bool = True) bool

Stop editing and discard the edits

Return type

bool

Returns

False if errors occurred during rollback

Parameters
  • rollbackErrors (Iterable[str]) –

  • stopEditing (bool = True) –

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

Start editing

Return type

bool

Returns

True on success

timerEvent(self, QTimerEvent)