QGIS API Documentation 4.1.0-Master (60fea48833c)
Loading...
Searching...
No Matches
qgsvectorlayereditbuffergroup.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsvectorlayereditbuffergroup.h - QgsVectorLayerEditBufferGroup
3
4 ---------------------
5 begin : 22.12.2021
6 copyright : (C) 2021 by Damiano Lombardi
8 ***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17#ifndef QGSVECTORLAYEREDITBUFFERGROUP_H
18#define QGSVECTORLAYEREDITBUFFERGROUP_H
19
20#include "qgis_core.h"
21#include "qgis_sip.h"
22
23#include <QObject>
24#include <QSet>
25
26class QgsVectorLayer;
27
40class CORE_EXPORT QgsVectorLayerEditBufferGroup : public QObject
41{
42 Q_OBJECT
43
44 public:
46 explicit QgsVectorLayerEditBufferGroup( QObject *parent = nullptr );
47
51 void addLayer( QgsVectorLayer *layer );
52
58 void removeLayer( QgsVectorLayer *layer );
59
63 void clear();
64
70 QSet<QgsVectorLayer *> layers() const;
71
77 QSet<QgsVectorLayer *> modifiedLayers() const;
78
84 bool startEditing();
85
107 bool commitChanges( QStringList &commitErrors SIP_OUT, bool stopEditing = true );
108
118 bool rollBack( QStringList &rollbackErrors SIP_OUT, bool stopEditing = true );
119
123 bool isEditing() const;
124
125 private:
126 QList<QgsVectorLayer *> orderLayersParentsToChildren( QSet<QgsVectorLayer *> layers );
127 void editingFinished( bool stopEditing );
128
129 QSet<QgsVectorLayer *> mLayers;
130
131 bool mIsEditing = false;
132};
133
134#endif // QGSVECTORLAYEREDITBUFFERGROUP_H
bool commitChanges(QStringList &commitErrors, bool stopEditing=true)
Attempts to commit any changes to disk.
void clear()
Remove all layers from this edit buffer group.
bool rollBack(QStringList &rollbackErrors, bool stopEditing=true)
Stop editing and discard the edits.
void removeLayer(QgsVectorLayer *layer)
Remove a layer from this edit buffer group.
void addLayer(QgsVectorLayer *layer)
Add a layer to this edit buffer group.
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.
QgsVectorLayerEditBufferGroup(QObject *parent=nullptr)
Constructor for QgsEditBufferGroup.
bool isEditing() const
Returns true if the layers are in editing mode.
Represents a vector layer which manages a vector based dataset.
#define SIP_OUT
Definition qgis_sip.h:57