QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
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
7  email : [email protected]
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 "qgis_core.h"
20 #include <QObject>
21 #include <QSet>
22 #include <memory>
23 #include "qgstransaction.h"
24 
25 class QgsVectorLayer;
26 
31 class CORE_EXPORT QgsTransactionGroup : public QObject
32 {
33  Q_OBJECT
34  public:
35 
37  explicit QgsTransactionGroup( QObject *parent = nullptr );
38 
44  bool addLayer( QgsVectorLayer *layer );
45 
51  QSet<QgsVectorLayer *> layers() const;
52 
56  bool modified() const;
57 
62  QString connString() const;
63 
68  QString providerKey() const;
69 
73  bool isEmpty() const;
74 
75  signals:
76 
80  void commitError( const QString &msg );
81 
82  private slots:
83  void onEditingStarted();
84  void onLayerDeleted();
85  void onBeforeCommitChanges( bool stopEditing );
86  void onRollback();
87 
88  private:
89  bool mEditingStarting = false;
90  bool mEditingStopping = false;
91 
92  void disableTransaction();
93 
94  void restartTransaction( const QgsVectorLayer *layer );
95 
96  QSet<QgsVectorLayer *> mLayers;
98  std::unique_ptr<QgsTransaction> mTransaction;
100  QString mConnString;
101  QString mProviderKey;
102 };
103 
104 #endif // QGSTRANSACTIONGROUP_H
QgsTransactionGroup
Definition: qgstransactiongroup.h:32
qgstransaction.h
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition: qgsvectorlayer.h:387
QgsTransactionGroup::commitError
void commitError(const QString &msg)
Will be emitted whenever there is a commit error.