QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
Public Member Functions | List of all members
QgsVectorLayerEditBufferGroup Class Reference

The edit buffer group manages a group of edit buffers. More...

#include <qgsvectorlayereditbuffergroup.h>

Inheritance diagram for QgsVectorLayerEditBufferGroup:
Inheritance graph
[legend]

Public Member Functions

 QgsVectorLayerEditBufferGroup (QObject *parent=nullptr)
 Constructor for QgsEditBufferGroup. More...
 
void addLayer (QgsVectorLayer *layer)
 Add a layer to this edit buffer group. More...
 
void clear ()
 Remove all layers from this edit buffer group. More...
 
bool commitChanges (QStringList &commitErrors, bool stopEditing=true)
 Attempts to commit any changes to disk. More...
 
bool isEditing () const
 Returns true if the layers are in editing mode. More...
 
QSet< QgsVectorLayer * > layers () const
 Gets the set of layers currently managed by this edit buffer group. More...
 
QSet< QgsVectorLayer * > modifiedLayers () const
 Gets the set of modified layers currently managed by this edit buffer group. More...
 
bool rollBack (QStringList &rollbackErrors, bool stopEditing=true)
 Stop editing and discard the edits. More...
 
bool startEditing ()
 Start editing. More...
 

Detailed Description

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.

Since
QGIS 3.26

Definition at line 38 of file qgsvectorlayereditbuffergroup.h.

Constructor & Destructor Documentation

◆ QgsVectorLayerEditBufferGroup()

QgsVectorLayerEditBufferGroup::QgsVectorLayerEditBufferGroup ( QObject *  parent = nullptr)
explicit

Constructor for QgsEditBufferGroup.

Definition at line 26 of file qgsvectorlayereditbuffergroup.cpp.

Member Function Documentation

◆ addLayer()

void QgsVectorLayerEditBufferGroup::addLayer ( QgsVectorLayer layer)

Add a layer to this edit buffer group.

Definition at line 32 of file qgsvectorlayereditbuffergroup.cpp.

◆ clear()

void QgsVectorLayerEditBufferGroup::clear ( )

Remove all layers from this edit buffer group.

Definition at line 37 of file qgsvectorlayereditbuffergroup.cpp.

◆ commitChanges()

bool QgsVectorLayerEditBufferGroup::commitChanges ( QStringList &  commitErrors,
bool  stopEditing = true 
)

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
commitErrorswill be set to a list of descriptive errors if the commit fails.
stopEditingif set to false, the layer will stay in editing mode. Otherwise the layer editing mode will be disabled if the commit is successful.
Returns
true on success

Definition at line 115 of file qgsvectorlayereditbuffergroup.cpp.

◆ isEditing()

bool QgsVectorLayerEditBufferGroup::isEditing ( ) const

Returns true if the layers are in editing mode.

Definition at line 378 of file qgsvectorlayereditbuffergroup.cpp.

◆ layers()

QSet< QgsVectorLayer * > QgsVectorLayerEditBufferGroup::layers ( ) const

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

Returns
Layer set

Definition at line 42 of file qgsvectorlayereditbuffergroup.cpp.

◆ modifiedLayers()

QSet< QgsVectorLayer * > QgsVectorLayerEditBufferGroup::modifiedLayers ( ) const

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

Returns
Layer set

Definition at line 47 of file qgsvectorlayereditbuffergroup.cpp.

◆ rollBack()

bool QgsVectorLayerEditBufferGroup::rollBack ( QStringList &  rollbackErrors,
bool  stopEditing = true 
)

Stop editing and discard the edits.

Parameters
rollbackErrorswill be set to a list of descriptive errors if the rollback fails.
stopEditingif set to false, the layer will stay in editing mode. Otherwise the layer editing mode will be disabled if the rollback is successful.
Returns
false if errors occurred during rollback

Definition at line 326 of file qgsvectorlayereditbuffergroup.cpp.

◆ startEditing()

bool QgsVectorLayerEditBufferGroup::startEditing ( )

Start editing.

Returns
true on success

Definition at line 58 of file qgsvectorlayereditbuffergroup.cpp.


The documentation for this class was generated from the following files: