QGIS API Documentation  3.6.0-Noosa (5873452)
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 onCommitChanges();
86  void onRollback();
87 
88  private:
89  bool mEditingStarting = false;
90  bool mEditingStopping = false;
91 
92  void disableTransaction();
93 
94  QSet<QgsVectorLayer *> mLayers;
96  std::unique_ptr<QgsTransaction> mTransaction;
98  QString mConnString;
99  QString mProviderKey;
100 };
101 
102 #endif // QGSTRANSACTIONGROUP_H
Represents a vector layer which manages a vector based data sets.