QGIS API Documentation  3.0.2-Girona (307d082)
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 
32 {
33  public:
34 
41  QgsVectorLayerUndoPassthroughCommand( QgsVectorLayerEditBuffer *buffer, const QString &text, bool autocreate = true );
42 
46  bool hasError() const { return mHasError; }
47 
48  protected:
49 
55  bool rollBackToSavePoint();
56 
63  bool setSavePoint( const QString &savePointId = QString() );
64 
68  void setError();
69 
75  void setErrorMessage( const QString &errorMessage );
76 
82  QString errorMessage() const;
83 
84  private:
85  QString mError;
86  QString mSavePointId;
87  bool mHasError;
88  bool mRecreateSavePoint;
89 };
90 
99 {
100  public:
101 
108 
109  void undo() override;
110  void redo() override;
111 
115  QgsFeatureList features() const { return mFeatures; }
116 
117  private:
118  QgsFeatureList mFeatures;
119  QgsFeatureList mInitialFeatures;
120 };
121 
122 
131 {
132  public:
133 
140 
141  void undo() override;
142  void redo() override;
143 
144  private:
145  const QgsFeatureIds mFids;
146 };
147 
156 {
157  public:
158 
166 
167  void undo() override;
168  void redo() override;
169 
170  private:
171  QgsFeatureId mFid;
172  const QgsGeometry mNewGeom;
173  const QgsGeometry mOldGeom;
174 };
175 
184 {
185  public:
186 
195 
196  void undo() override;
197  void redo() override;
198 
199  private:
200  QgsFeatureId mFid;
201  const int mField;
202  const QVariant mNewValue;
203  const QVariant mOldValue;
204 };
205 
214 {
215  public:
216 
225 
226  void undo() override;
227  void redo() override;
228 
229  private:
230  QgsFeatureId mFid;
231  const QgsAttributeMap mNewValues;
232  const QgsAttributeMap mOldValues;
233 };
234 
243 {
244  public:
245 
252 
253  void undo() override;
254  void redo() override;
255 
256  private:
257  const QgsField mField;
258 };
259 
268 {
269  public:
270 
277 
278  void undo() override;
279  void redo() override;
280 
281  private:
282  const QgsField mField;
283 };
284 
293 {
294  public:
295 
303 
304  void undo() override;
305  void redo() override;
306 
307  private:
308  const int mAttr;
309  const QString mNewName;
310  const QString mOldName;
311 };
312 
321 {
322  public:
323 
331  QgsVectorLayerUndoPassthroughCommandUpdate( QgsVectorLayerEditBuffer *buffer SIP_TRANSFER, QgsTransaction *transaction, const QString &sql, const QString &name );
332 
333  void undo() override;
334  void redo() override;
335 
336  private:
337  QgsTransaction *mTransaction = nullptr;
338  QString mSql;
339  bool mUndone = false;
340 };
341 
342 #endif
Undo command for deleting attri of a vector layer in transaction group.
Undo command for deleting attri of a vector layer in transaction group.
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeature.h:544
QList< QgsFeature > QgsFeatureList
Definition: qgsfeature.h:549
Base class for undo commands within a QgsVectorLayerEditBuffer.
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:111
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:39
#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.
qint64 QgsFeatureId
Definition: qgsfeature.h:37