Walls And Holes  1
emptyparentcommand.h
Go to the documentation of this file.
1 #ifndef EMPTYPARENTCOMMAND_H
2 #define EMPTYPARENTCOMMAND_H
3 
4 #include <QUndoCommand>
5 
12 class EmptyParentCommand : public QUndoCommand
13 {
14 public:
15 
22  static EmptyParentCommand *make(const QString &text, QUndoCommand *parent = nullptr);
23 
24 
25  void redo() override;
26  void undo() override;
27 
28 private:
29 
30  bool checkIfChildrenObsolete() const;
31 
32  EmptyParentCommand(const QString &text, QUndoCommand *parent);
33 };
34 
35 #endif // EMPTYPARENTCOMMAND_H
static EmptyParentCommand * make(const QString &text, QUndoCommand *parent=nullptr)
make Makes an empty parent command with the given text.
Definition: emptyparentcommand.cpp:3
The EmptyParentCommand class works almost exactly like the default QUndoCommand implementation, except that it sets itself obsolete if all of its children are obsolete. This way, command macros that do nothing will get removed.
Definition: emptyparentcommand.h:12
void redo() override
Definition: emptyparentcommand.cpp:9
void undo() override
Definition: emptyparentcommand.cpp:18