QGIS API Documentation 3.99.0-Master (21b3aa880ba)
Loading...
Searching...
No Matches
qgstransactiongroup.h
Go to the documentation of this file.
1/***************************************************************************
2 qgstransactiongroup.h - QgsTransactionGroup
3
4 ---------------------
5 begin : 15.1.2016
6 copyright : (C) 2016 by Matthias Kuhn
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#ifndef QGSTRANSACTIONGROUP_H
17#define QGSTRANSACTIONGROUP_H
18
19#include <memory>
20
21#include "qgis_core.h"
22#include "qgstransaction.h"
23
24#include <QObject>
25#include <QSet>
26
27class QgsVectorLayer;
28
34class CORE_EXPORT QgsTransactionGroup : public QObject
35{
36 Q_OBJECT
37 public:
38
40 explicit QgsTransactionGroup( QObject *parent = nullptr );
41
47 bool addLayer( QgsVectorLayer *layer );
48
54 QSet<QgsVectorLayer *> layers() const;
55
59 bool modified() const;
60
65 QString connString() const;
66
71 QString providerKey() const;
72
76 bool isEmpty() const;
77
78 signals:
79
83 void commitError( const QString &msg );
84
85 private slots:
86 void onEditingStarted();
87 void onLayerDeleted();
88 void onBeforeCommitChanges( bool stopEditing );
89 void onRollback();
90
91 private:
92 bool mEditingStopping = false;
93
94 void disableTransaction();
95
96 void restartTransaction( const QgsVectorLayer *layer );
97
98 QSet<QgsVectorLayer *> mLayers;
100 std::unique_ptr<QgsTransaction> mTransaction;
102 QString mConnString;
103 QString mProviderKey;
104};
105
106#endif // QGSTRANSACTIONGROUP_H
QString connString() const
Returns the connection string used by this transaction group.
bool modified() const
Returns true if any of the layers in this group reports a modification.
QgsTransactionGroup(QObject *parent=nullptr)
Constructor for QgsTransactionGroup.
bool isEmpty() const
Returns true if there are no layers in this transaction group.
void commitError(const QString &msg)
Will be emitted whenever there is a commit error.
QString providerKey() const
Returns the provider key used by this transaction group.
bool addLayer(QgsVectorLayer *layer)
Add a layer to this transaction group.
QSet< QgsVectorLayer * > layers() const
Gets the set of layers currently managed by this transaction group.
Represents a vector layer which manages a vector based dataset.