QGIS API Documentation  2.14.0-Essen
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 
25 class CORE_EXPORT QgsTransactionGroup : public QObject
26 {
27  Q_OBJECT
28  public:
29  explicit QgsTransactionGroup( QObject *parent = 0 );
30 
32 
38  bool addLayer( QgsVectorLayer* layer );
39 
45  QSet<QgsVectorLayer*> layers() const;
46 
50  bool modified() const;
51 
56  QString connString() const;
57 
62  QString providerKey() const;
63 
67  bool isEmpty() const;
68 
69  signals:
73  void commitError( const QString& msg );
74 
75  private slots:
76  void onEditingStarted();
77  void onLayerDeleted();
78  void onCommitChanges();
79  void onRollback();
80 
81  private:
82  bool mEditingStarting;
83  bool mEditingStopping;
84 
85  void disableTransaction();
86 
87  QSet<QgsVectorLayer*> mLayers;
89  QScopedPointer<QgsTransaction> mTransaction;
91  QString mConnString;
92  QString mProviderKey;
93 };
94 
95 #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.