QGIS API Documentation  3.4.15-Madeira (e83d02e274)
qgsvectorlayerundopassthroughcommand.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsvectorlayerundopassthroughcommand.h
3  ---------------------
4  begin : June 2017
5  copyright : (C) 2017 by Vincent Mora
6  email : vincent dot mora at osalndia dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSVECTORLAYERUNDOPASSTHROUGHCOMMAND_H
17 #define QGSVECTORLAYERUNDOPASSTHROUGHCOMMAND_H
18 
20 
22 
23 class QgsTransaction;
24 
34 {
35  public:
36 
43  QgsVectorLayerUndoPassthroughCommand( QgsVectorLayerEditBuffer *buffer, const QString &text, bool autocreate = true );
44 
48  bool hasError() const { return mHasError; }
49 
50  protected:
51 
57  bool rollBackToSavePoint();
58 
65  bool setSavePoint( const QString &savePointId = QString() );
66 
70  void setError();
71 
77  void setErrorMessage( const QString &errorMessage );
78 
84  QString errorMessage() const;
85 
86  private:
87  QString mError;
88  QString mSavePointId;
89  bool mHasError;
90  bool mRecreateSavePoint;
91 };
92 
101 {
102  public:
103 
110 
111  void undo() override;
112  void redo() override;
113 
117  QgsFeatureList features() const { return mFeatures; }
118 
119  private:
120  QgsFeatureList mFeatures;
121  QgsFeatureList mInitialFeatures;
122 };
123 
124 
133 {
134  public:
135 
142 
143  void undo() override;
144  void redo() override;
145 
146  private:
147  const QgsFeatureIds mFids;
148 };
149 
158 {
159  public:
160 
168 
169  void undo() override;
170  void redo() override;
171 
172  private:
173  QgsFeatureId mFid;
174  const QgsGeometry mNewGeom;
175  const QgsGeometry mOldGeom;
176 };
177 
186 {
187  public:
188 
197 
198  void undo() override;
199  void redo() override;
200 
201  private:
202  QgsFeatureId mFid;
203  const int mField;
204  const QVariant mNewValue;
205  const QVariant mOldValue;
206 };
207 
216 {
217  public:
218 
227 
228  void undo() override;
229  void redo() override;
230 
231  private:
232  QgsFeatureId mFid;
233  const QgsAttributeMap mNewValues;
234  const QgsAttributeMap mOldValues;
235 };
236 
245 {
246  public:
247 
254 
255  void undo() override;
256  void redo() override;
257 
258  private:
259  const QgsField mField;
260 };
261 
270 {
271  public:
272 
279 
280  void undo() override;
281  void redo() override;
282 
283  private:
284  const QgsField mField;
285 };
286 
295 {
296  public:
297 
305 
306  void undo() override;
307  void redo() override;
308 
309  private:
310  const int mAttr;
311  const QString mNewName;
312  const QString mOldName;
313 };
314 
323 {
324  public:
325 
333  QgsVectorLayerUndoPassthroughCommandUpdate( QgsVectorLayerEditBuffer *buffer SIP_TRANSFER, QgsTransaction *transaction, const QString &sql, const QString &name );
334 
335  void undo() override;
336  void redo() override;
337 
338  private:
339  QgsTransaction *mTransaction = nullptr;
340  QString mSql;
341  bool mUndone = false;
342 };
343 
344 #endif
Undo command for deleting attri of a vector layer in transaction group.
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeatureid.h:34
Undo command for deleting attri of a vector layer in transaction group.
QList< QgsFeature > QgsFeatureList
Definition: qgsfeature.h:571
qint64 QgsFeatureId
Definition: qgsfeatureid.h:25
Base class for undo commands within a QgsVectorLayerEditBuffer.
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:106
Undo command for vector layer in transaction group mode.
Undo command for adding attri to a vector layer in transaction group.
Undo command for changing attr value from a vector layer in transaction group.
Undo command for changing feature geometry from a vector layer in transaction group.
QMap< int, QVariant > QgsAttributeMap
Definition: qgsattributes.h:38
#define SIP_TRANSFER
Definition: qgis_sip.h:36
Undo command for running a specific sql query in transaction group.
Encapsulate a field in an attribute table or data source.
Definition: qgsfield.h:48
QgsFeatureList features() const
List of features (added feaures can be modified by default values from database)
Undo command for deleting features from a vector layer in transaction group.
Undo command for changing attributes&#39; values from a vector layer in transaction group.
This class allows including a set of layers in a database-side transaction, provided the layer data p...
Undo command for adding a feature to a vector layer in transaction group mode.