BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Provides undo/redo for all commands of SessionModel. More...
Public Member Functions | |
CommandService (SessionModel *model) | |
SessionItem * | copyItem (const SessionItem *item, SessionItem *parent, const TagRow &tagrow) |
SessionItem * | insertNewItem (const item_factory_func_t &func, SessionItem *parent, const TagRow &tagrow) |
void | moveItem (SessionItem *item, SessionItem *new_parent, const TagRow &tagrow) |
void | removeItem (SessionItem *parent, const TagRow &tagrow) |
void | setCommandRecordPause (bool value) |
bool | setData (SessionItem *item, const Variant &value, int role) |
void | setUndoRedoEnabled (bool value) |
UndoStackInterface * | undoStack () const |
Private Member Functions | |
template<typename C , typename... Args> | |
CommandResult | process_command (Args &&... args) |
Creates and processes command of given type using given argument list. More... | |
bool | provideUndo () const |
Private Attributes | |
std::unique_ptr< UndoStackInterface > | m_commands |
SessionModel * | m_model |
bool | m_pause_record |
Provides undo/redo for all commands of SessionModel.
Definition at line 35 of file commandservice.h.
CommandService::CommandService | ( | SessionModel * | model | ) |
Definition at line 27 of file commandservice.cpp.
SessionItem * CommandService::copyItem | ( | const SessionItem * | item, |
SessionItem * | parent, | ||
const TagRow & | tagrow | ||
) |
Definition at line 49 of file commandservice.cpp.
References ModelView::SessionItem::itemCount(), m_model, ModelView::SessionItem::model(), ModelView::TagRow::row, and ModelView::TagRow::tag.
SessionItem * CommandService::insertNewItem | ( | const item_factory_func_t & | func, |
SessionItem * | parent, | ||
const TagRow & | tagrow | ||
) |
Definition at line 37 of file commandservice.cpp.
References ModelView::SessionItem::itemCount(), m_model, ModelView::SessionModel::rootItem(), ModelView::TagRow::row, and ModelView::TagRow::tag.
void CommandService::moveItem | ( | SessionItem * | item, |
SessionItem * | new_parent, | ||
const TagRow & | tagrow | ||
) |
Definition at line 82 of file commandservice.cpp.
References ModelView::SessionItem::itemCount(), m_model, ModelView::SessionItem::model(), ModelView::TagRow::row, and ModelView::TagRow::tag.
|
private |
Creates and processes command of given type using given argument list.
Definition at line 69 of file commandservice.h.
References m_commands, and provideUndo().
|
private |
Definition at line 107 of file commandservice.cpp.
References m_commands, and m_pause_record.
Referenced by process_command().
void CommandService::removeItem | ( | SessionItem * | parent, |
const TagRow & | tagrow | ||
) |
Definition at line 73 of file commandservice.cpp.
References m_model, and ModelView::SessionItem::model().
void CommandService::setCommandRecordPause | ( | bool | value | ) |
Definition at line 102 of file commandservice.cpp.
References m_pause_record.
bool CommandService::setData | ( | SessionItem * | item, |
const Variant & | value, | ||
int | role | ||
) |
Definition at line 65 of file commandservice.cpp.
void CommandService::setUndoRedoEnabled | ( | bool | value | ) |
UndoStackInterface * CommandService::undoStack | ( | ) | const |
Definition at line 97 of file commandservice.cpp.
References m_commands.
|
private |
Definition at line 62 of file commandservice.h.
Referenced by process_command(), provideUndo(), setUndoRedoEnabled(), and undoStack().
|
private |
Definition at line 61 of file commandservice.h.
Referenced by copyItem(), insertNewItem(), moveItem(), and removeItem().
|
private |
Definition at line 63 of file commandservice.h.
Referenced by provideUndo(), and setCommandRecordPause().