
Public Member Functions | |
| PCommand (ContextItem *item, const char *slot, const QString &des) | |
| PCommand (ContextItem *item, const char *slot, QVariant doValue, QVariant undoValue, const QString &des) | |
| int | prepare_actions () |
| int | do_action () |
| int | undo_action () |
| int | begin_hold () |
| int | finish_hold () |
Use this class to create actions that basically involve calling one function to set and restore a value.
E.g. setting and resetting the gain of an object can be done like this:
PCommand(SomeObject, "do_something", newvalue, oldvalue, tr("MyObject: Did something"));
where SomeObject is a pointer to a QObject derived class, and "do_something" is a function that accepts a value of the type of newvalue/oldvalue. "do_something" needs to be declared as a public slot!
Supported types are: TimeRef, double and float.
| int PCommand::prepare_actions | ( | ) | [virtual] |
Virtual function, needs to be reimplemented for all type of Commands
Use this function to do any kind of calculation or information gathering to be able to perform the actual action in do_action()
Reimplemented from Command.
| int PCommand::do_action | ( | ) | [virtual] |
Virtual function, needs to be reimplemented for all type of Commands
This function is called after the action is finished and each time the historystack 'redoes' an action.
Normally the data created in prepare_actions() will be used here to do the actuall action, which most of the case will be one or a few functions calls.
In case of a Single fact type of Command, you should also retrieve
the 'old' state here to be able to restore it in undo_action()
Reimplemented from Command.
| int PCommand::undo_action | ( | ) | [virtual] |
Virtual function, needs to be reimplemented for all type of Commands
This function is called each time the historystack 'undoes' an action,
use prepare_actions(), or in case of a hold type command begin_hold() to
store the old value(s), your command will change in do_action(), and use
those here to restore the old state.
Reimplemented from Command.
| int PCommand::begin_hold | ( | ) | [virtual] |
Virtual function, only needs to be reimplemented when making a hold type of Command
In case of a 'Hold fact' type of Command, you should also retrieve
the 'old' state here to be able to restore it in undo_action()
Reimplemented from Command.
| int PCommand::finish_hold | ( | ) | [virtual] |
1.5.5