CompositeCommand.h header
#include <ew/core/CompositeCommand.h>
Namespace ew::core
CompositeCommand class
class ew::core::CompositeCommand
A command that groups several sub-commands into one undoable unit: apply() runs them in order and undo() reverses them in the opposite order, so a multi-step edit (e.g. creating and updating many entities at once) is a single entry on the undo stack.
Members
ew::core::CompositeCommand::CompositeCommand(QString description, std::vector< std::unique_ptr< Command > > commands)
Creates a composite with the undo/redo description that runs commands in order.
ew::core::CompositeCommand::~CompositeCommand() override
Destroys the command.
void ew::core::CompositeCommand::apply() override
Applies every sub-command in order.
void ew::core::CompositeCommand::undo() override
Undoes every sub-command in reverse order.
QString ew::core::CompositeCommand::description() const override
Returns the composite's description.
bool ew::core::CompositeCommand::isEmpty() const
Whether the composite holds no sub-commands.
void ew::core::CompositeCommand::adopt(std::unique_ptr< Command > command)
Appends command WITHOUT applying it – for a group that applied each member as it was collected (see CommandStack::beginGroup); undo/redo then treat the set as one unit. Null commands are ignored.