QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
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 <QObject>
20 #include <QSet>
21 
22 class QgsVectorLayer;
23 class QgsTransaction;
24 
28 class CORE_EXPORT QgsTransactionGroup : public QObject
29 {
30  Q_OBJECT
31  public:
32  explicit QgsTransactionGroup( QObject *parent = 0 );
33 
35 
41  bool addLayer( QgsVectorLayer* layer );
42 
48  QSet<QgsVectorLayer*> layers() const;
49 
53  bool modified() const;
54 
59  QString connString() const;
60 
65  QString providerKey() const;
66 
70  bool isEmpty() const;
71 
72  signals:
76  void commitError( const QString& msg );
77 
78  private slots:
79  void onEditingStarted();
80  void onLayerDeleted();
81  void onCommitChanges();
82  void onRollback();
83 
84  private:
85  bool mEditingStarting;
86  bool mEditingStopping;
87 
88  void disableTransaction();
89 
90  QSet<QgsVectorLayer*> mLayers;
92  QScopedPointer<QgsTransaction> mTransaction;
94  QString mConnString;
95  QString mProviderKey;
96 };
97 
98 #endif // QGSTRANSACTIONGROUP_H
This class allows including a set of layers in a database-side transaction, provided the layer data p...
Represents a vector layer which manages a vector based data sets.