QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgsmodelundocommand.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmodelundocommand.h
3  ----------------------------------
4  Date : March 2020
5  Copyright : (C) 2020 Nyall Dawson
6  Email : nyall dot dawson at gmail 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 QGSMODELUNDOCOMMAND_H
17 #define QGSMODELUNDOCOMMAND_H
18 
19 #include "qgis.h"
20 #include "qgis_gui.h"
21 #include <QUndoCommand>
22 
23 class QgsProcessingModelAlgorithm;
24 
25 #define SIP_NO_FILE
26 
28 
35 class GUI_EXPORT QgsModelUndoCommand : public QUndoCommand
36 {
37  public:
38  QgsModelUndoCommand( QgsProcessingModelAlgorithm *model, const QString &text, int id = 0, QUndoCommand *parent SIP_TRANSFERTHIS = nullptr );
39 
43  void saveAfterState();
44 
45  int id() const override;
46  void undo() override;
47  void redo() override;
48  bool mergeWith( const QUndoCommand *other ) override;
49 
50  private:
51 
53  bool mFirstRun = true;
54 
55  QgsProcessingModelAlgorithm *mModel = nullptr;
56  QVariant mBeforeState;
57  QVariant mAfterState;
58  int mId = 0;
59 };
60 
62 
63 #endif // QGSMODELUNDOCOMMAND_H
qgis.h
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53