15 #ifndef BORNAGAIN_MVVM_MODEL_MVVM_COMMANDS_COMMANDSERVICE_H
16 #define BORNAGAIN_MVVM_MODEL_MVVM_COMMANDS_COMMANDSERVICE_H
22 #include "mvvm/model_export.h"
39 void setUndoRedoEnabled(
bool value);
54 void setCommandRecordPause(
bool value);
57 template <
typename C,
typename... Args>
CommandResult process_command(Args&&... args);
59 bool provideUndo()
const;
68 template <
typename C,
typename... Args>
73 auto command = std::make_shared<C>(std::forward<Args>(args)...);
75 return command->result();
77 C command(std::forward<Args>(args)...);
79 return command.result();
Provides undo/redo for all commands of SessionModel.
CommandResult process_command(Args &&... args)
Creates and processes command of given type using given argument list.
std::unique_ptr< UndoStackInterface > m_commands
The main object representing an editable/displayable/serializable entity.
Main class to hold hierarchy of SessionItem objects.
Aggregate to hold (tag, row) information for SessionModel.
Interface class for undo/redo stack.
materialitems.h Collection of materials to populate MaterialModel.
std::function< std::unique_ptr< SessionItem >()> item_factory_func_t
Definition for item factory funciton.
std::variant< bool, ModelView::SessionItem * > CommandResult
Results of command execution.