QGIS API Documentation  3.10.0-A Coruña (6c816b4204)
qgslayoutitemgroupundocommand.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgslayoutitemgroupundocommand.h
3  -------------------------------
4  begin : 2016-06-09
5  copyright : (C) 2016 by Sandro Santilli
6  email : strk at kbt dot io
7 ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSLAYOUTITEMGROUPUNDOCOMMAND_H
19 #define QGSLAYOUTITEMGROUPUNDOCOMMAND_H
20 
21 #include "qgis_core.h"
22 #include <QUndoCommand>
23 #include "qgslayoutitem.h"
24 
25 #define SIP_NO_FILE
26 
33 class CORE_EXPORT QgsLayoutItemGroupUndoCommand: public QObject, public QUndoCommand
34 {
35  Q_OBJECT
36 
37  public:
38 
40  enum State
41  {
42  Grouped = 0,
43  Ungrouped
44  };
45 
56  QgsLayoutItemGroupUndoCommand( State s, QgsLayoutItemGroup *group, QgsLayout *layout,
57  const QString &text, QUndoCommand *parent = nullptr );
58 
59  void redo() override;
60  void undo() override;
61 
62  private:
63  QString mGroupUuid;
64  QSet<QString> mItemUuids;
65  QgsLayout *mLayout = nullptr;
66  State mState;
68  bool mFirstRun = true;
69 
70  //changes between added / removed state
71  void switchState();
72 };
74 
75 #endif // QGSLAYOUTITEMGROUPUNDOCOMMAND_H
A container for grouping several QgsLayoutItems.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
Definition: qgslayout.h:49