1 #ifndef CHANGEVALUECOMMAND_H 2 #define CHANGEVALUECOMMAND_H 5 #include <QUndoCommand> 8 template<
typename ValueType >
25 template<
typename Func >
32 QUndoCommand *parent =
nullptr)
34 std::function<void()> func = postChangeFunc;
49 template<
typename Func >
55 QUndoCommand *parent =
nullptr)
57 ValueType oldValue = *variable;
58 return make(variable, newValue, oldValue, text, postChangeFunc, parent);
73 QUndoCommand *parent =
nullptr)
75 return make(variable, newValue, text, [](){}, parent);
100 std::function<
void()> postChange,
101 QUndoCommand *parent)
102 : QUndoCommand(text, parent)
106 , mPostChangeFunc(postChange) {}
113 std::function<void()> mPostChangeFunc;
116 #endif // CHANGEVALUECOMMAND_H Definition: changevaluecommand.h:9
void redo() override
Definition: changevaluecommand.h:82
static ChangeValueCommand * make(ValueType *variable, ValueType newValue, ValueType oldValue, const QString &text, Func postChangeFunc, QUndoCommand *parent=nullptr)
make Creates a change-value command.
Definition: changevaluecommand.h:26
void undo() override
Definition: changevaluecommand.h:88
static ChangeValueCommand * make(ValueType *variable, ValueType newValue, const QString &text, QUndoCommand *parent=nullptr)
make Creates a change-value command.
Definition: changevaluecommand.h:69
static ChangeValueCommand * make(ValueType *variable, ValueType newValue, const QString &text, Func postChangeFunc, QUndoCommand *parent=nullptr)
make Creates a change-value command.
Definition: changevaluecommand.h:50