-
-
Notifications
You must be signed in to change notification settings - Fork 3k
/
qgstransactiongroup.h
83 lines (68 loc) · 2.39 KB
/
qgstransactiongroup.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/***************************************************************************
qgstransactiongroup.h - QgsTransactionGroup
---------------------
begin : 15.1.2016
copyright : (C) 2016 by Matthias Kuhn
email : mmatthias@opengis.ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSTRANSACTIONGROUP_H
#define QGSTRANSACTIONGROUP_H
#include <QObject>
#include <QSet>
class QgsVectorLayer;
class QgsTransaction;
class CORE_EXPORT QgsTransactionGroup : public QObject
{
Q_OBJECT
public:
explicit QgsTransactionGroup( QObject *parent = 0 );
~QgsTransactionGroup();
/**
* Add a layer to this transaction group.
*
* Will return true if it is compatible and has been added.
*/
bool addLayer( QgsVectorLayer* layer );
/**
* Return the connection string used by this transaction group.
* Layers need be compatible when added.
*/
QString connString() const;
/**
* Return the provider key used by this transaction group.
* Layers need be compatible when added.
*/
QString providerKey() const;
/**
* Returns true if there are no layers in this transaction group.
*/
bool isEmpty() const;
signals:
/**
* Will be emitted whenever there is a commit error
*/
void commitError( const QString& msg );
private slots:
void onEditingStarted();
void onLayerDeleted();
void onCommitChanges();
void onRollback();
private:
bool mEditingStarting;
bool mEditingStopping;
void disableTransaction();
QSet<QgsVectorLayer*> mLayers;
//! Only set while a transaction is active
QScopedPointer<QgsTransaction> mTransaction;
//! Layers have to be compatible with the connection string
QString mConnString;
QString mProviderKey;
};
#endif // QGSTRANSACTIONGROUP_H