QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
qgsgroupungroupitemscommand.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsgroupungroupitemscommand.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 QGSGROUPUNGROUPITEMSCOMMAND_H
19 #define QGSGROUPUNGROUPITEMSCOMMAND_H
20 
21 #include <QUndoCommand>
22 #include "qgscomposeritemgroup.h"
23 class QgsComposerItem;
24 class QgsComposition;
25 
31 class CORE_EXPORT QgsGroupUngroupItemsCommand: public QObject, public QUndoCommand
32 {
33  Q_OBJECT
34 
35  public:
36 
38  enum State
39  {
40  Grouped = 0,
41  Ungrouped
42  };
43 
53  QgsGroupUngroupItemsCommand( State s, QgsComposerItemGroup* item, QgsComposition* c, const QString& text, QUndoCommand* parent = nullptr );
55 
56  void redo() override;
57  void undo() override;
58 
59  signals:
61  void itemAdded( QgsComposerItem* item );
63  void itemRemoved( QgsComposerItem* item );
64 
65  private:
66  QgsComposerItemGroup* mGroup;
68  QgsComposition* mComposition;
69  State mState;
70  bool mFirstRun; //flag to prevent execution when the command is pushed to the QUndoStack
71 
72  //changes between added / removed state
73  void switchState();
74 };
75 
76 #endif // QGSGROUPUNGROUPITEMSCOMMAND_H
A item that forms part of a map composition.
A container for grouping several QgsComposerItems.
virtual void redo()
Graphics scene for map printing.
A composer command class for grouping / ungrouping composer items.
virtual void undo()