QGIS API Documentation 3.41.0-Master (d5b93354e9c)
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 "qgis_core.h"
20#include <QObject>
21#include <QSet>
22#include <memory>
23#include "qgstransaction.h"
24
25class QgsVectorLayer;
26
31class 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 mEditingStopping = false;
90
91 void disableTransaction();
92
93 void restartTransaction( const QgsVectorLayer *layer );
94
95 QSet<QgsVectorLayer *> mLayers;
97 std::unique_ptr<QgsTransaction> mTransaction;
99 QString mConnString;
100 QString mProviderKey;
101};
102
103#endif // QGSTRANSACTIONGROUP_H
void commitError(const QString &msg)
Will be emitted whenever there is a commit error.
Represents a vector layer which manages a vector based data sets.