45 return std::get<SessionItem*>(
46 process_command<InsertNewItemCommand>(func, parent,
TagRow{tagrow.
tag, actual_row}));
56 throw std::runtime_error(
57 "CommandService::copyItem() -> Item doesn't belong to given model");
61 return std::get<SessionItem*>(
62 process_command<CopyItemCommand>(item, parent,
TagRow{tagrow.
tag, actual_row}));
70 return std::get<bool>(process_command<SetValueCommand>(item, value, role));
76 throw std::runtime_error(
77 "CommandService::removeRow() -> Item doesn't belong to given model");
79 process_command<RemoveItemCommand>(parent, tagrow);
85 throw std::runtime_error(
86 "CommandService::removeRow() -> Item doesn't belong to given model");
89 throw std::runtime_error(
90 "CommandService::removeRow() -> Parent doesn't belong to given model");
94 process_command<MoveItemCommand>(item, new_parent,
TagRow{tagrow.
tag, actual_row});
bool setData(SessionItem *item, const Variant &value, int role)
void moveItem(SessionItem *item, SessionItem *new_parent, const TagRow &tagrow)
SessionItem * copyItem(const SessionItem *item, SessionItem *parent, const TagRow &tagrow)
void setCommandRecordPause(bool value)
SessionItem * insertNewItem(const item_factory_func_t &func, SessionItem *parent, const TagRow &tagrow)
void removeItem(SessionItem *parent, const TagRow &tagrow)
void setUndoRedoEnabled(bool value)
CommandService(SessionModel *model)
UndoStackInterface * undoStack() const
std::unique_ptr< UndoStackInterface > m_commands
The main object representing an editable/displayable/serializable entity.
int itemCount(const std::string &tag) const
Returns number of items in given tag.
SessionModel * model() const
Returns the model to which given item belongs to.
Main class to hold hierarchy of SessionItem objects.
SessionItem * rootItem() const
Returns root item of the model.
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.