QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
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.
 
void addLayer (QgsVectorLayer *layer)
 Add a layer to this edit buffer group.
 
void clear ()
 Remove all layers from this edit buffer group.
 
bool commitChanges (QStringList &commitErrors, bool stopEditing=true)
 Attempts to commit any changes to disk.
 
bool isEditing () const
 Returns true if the layers are in editing mode.
 
QSet< QgsVectorLayer * > layers () const
 Gets the set of layers currently managed by this edit buffer group.
 
QSet< QgsVectorLayer * > modifiedLayers () const
 Gets the set of modified layers currently managed by this edit buffer group.
 
void removeLayer (QgsVectorLayer *layer)
 Remove a layer from this edit buffer group.
 
bool rollBack (QStringList &rollbackErrors, bool stopEditing=true)
 Stop editing and discard the edits.
 
bool startEditing ()
 Start editing.
 

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 40 of file qgsvectorlayereditbuffergroup.h.

Constructor & Destructor Documentation

◆ QgsVectorLayerEditBufferGroup()

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

Constructor for QgsEditBufferGroup.

Definition at line 27 of file qgsvectorlayereditbuffergroup.cpp.

Member Function Documentation

◆ addLayer()

void QgsVectorLayerEditBufferGroup::addLayer ( QgsVectorLayer layer)

Add a layer to this edit buffer group.

Definition at line 33 of file qgsvectorlayereditbuffergroup.cpp.

◆ clear()

void QgsVectorLayerEditBufferGroup::clear ( )

Remove all layers from this edit buffer group.

Definition at line 43 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 121 of file qgsvectorlayereditbuffergroup.cpp.

◆ isEditing()

bool QgsVectorLayerEditBufferGroup::isEditing ( ) const

Returns true if the layers are in editing mode.

Definition at line 391 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 48 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 53 of file qgsvectorlayereditbuffergroup.cpp.

◆ removeLayer()

void QgsVectorLayerEditBufferGroup::removeLayer ( QgsVectorLayer layer)

Remove a layer from this edit buffer group.

Since
QGIS 3.42

Definition at line 38 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 339 of file qgsvectorlayereditbuffergroup.cpp.

◆ startEditing()

bool QgsVectorLayerEditBufferGroup::startEditing ( )

Start editing.

Returns
true on success

Definition at line 64 of file qgsvectorlayereditbuffergroup.cpp.


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