QGIS API Documentation 3.41.0-Master (af5edcb665c)
|
The edit buffer group manages a group of edit buffers. More...
#include <qgsvectorlayereditbuffergroup.h>
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. | |
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.
Definition at line 40 of file qgsvectorlayereditbuffergroup.h.
|
explicit |
Constructor for QgsEditBufferGroup.
Definition at line 27 of file qgsvectorlayereditbuffergroup.cpp.
void QgsVectorLayerEditBufferGroup::addLayer | ( | QgsVectorLayer * | layer | ) |
Add a layer to this edit buffer group.
Definition at line 33 of file qgsvectorlayereditbuffergroup.cpp.
void QgsVectorLayerEditBufferGroup::clear | ( | ) |
Remove all layers from this edit buffer group.
Definition at line 43 of file qgsvectorlayereditbuffergroup.cpp.
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.
commitErrors | will be set to a list of descriptive errors if the commit fails. |
stopEditing | if set to false , the layer will stay in editing mode. Otherwise the layer editing mode will be disabled if the commit is successful. |
true
on success Definition at line 121 of file qgsvectorlayereditbuffergroup.cpp.
bool QgsVectorLayerEditBufferGroup::isEditing | ( | ) | const |
Returns true
if the layers are in editing mode.
Definition at line 391 of file qgsvectorlayereditbuffergroup.cpp.
QSet< QgsVectorLayer * > QgsVectorLayerEditBufferGroup::layers | ( | ) | const |
Gets the set of layers currently managed by this edit buffer group.
Definition at line 48 of file qgsvectorlayereditbuffergroup.cpp.
QSet< QgsVectorLayer * > QgsVectorLayerEditBufferGroup::modifiedLayers | ( | ) | const |
Gets the set of modified layers currently managed by this edit buffer group.
Definition at line 53 of file qgsvectorlayereditbuffergroup.cpp.
void QgsVectorLayerEditBufferGroup::removeLayer | ( | QgsVectorLayer * | layer | ) |
Remove a layer from this edit buffer group.
Definition at line 38 of file qgsvectorlayereditbuffergroup.cpp.
bool QgsVectorLayerEditBufferGroup::rollBack | ( | QStringList & | rollbackErrors, |
bool | stopEditing = true |
||
) |
Stop editing and discard the edits.
rollbackErrors | will be set to a list of descriptive errors if the rollback fails. |
stopEditing | if set to false , the layer will stay in editing mode. Otherwise the layer editing mode will be disabled if the rollback is successful. |
false
if errors occurred during rollback Definition at line 339 of file qgsvectorlayereditbuffergroup.cpp.
bool QgsVectorLayerEditBufferGroup::startEditing | ( | ) |
Start editing.
true
on success Definition at line 64 of file qgsvectorlayereditbuffergroup.cpp.