QGIS API Documentation 4.1.0-Master (60fea48833c)
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:
39 explicit QgsTransactionGroup( QObject *parent = nullptr );
40
46 bool addLayer( QgsVectorLayer *layer );
47
53 QSet<QgsVectorLayer *> layers() const;
54
58 bool modified() const;
59
64 QString connString() const;
65
70 QString providerKey() const;
71
75 bool isEmpty() const;
76
77 signals:
78
82 void commitError( const QString &msg );
83
84 private slots:
85 void onEditingStarted();
86 void onLayerDeleted();
87 void onBeforeCommitChanges( bool stopEditing );
88 void onRollback();
89
90 private:
91 bool mEditingStopping = false;
92
93 void disableTransaction();
94
95 void restartTransaction( const QgsVectorLayer *layer );
96
97 QSet<QgsVectorLayer *> mLayers;
99 std::unique_ptr<QgsTransaction> mTransaction;
101 QString mConnString;
102 QString mProviderKey;
103};
104
105#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.