BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ModelView::CommandAdapter Class Reference

Adapter to execute our commands within Qt undo/redo framework. More...

Inheritance diagram for ModelView::CommandAdapter:
[legend]
Collaboration diagram for ModelView::CommandAdapter:
[legend]

Public Member Functions

 CommandAdapter (std::shared_ptr< AbstractItemCommand > command)
 
 ~CommandAdapter () override
 
void redo () override
 
void undo () override
 

Private Attributes

std::shared_ptr< AbstractItemCommandm_command
 

Detailed Description

Adapter to execute our commands within Qt undo/redo framework.

Definition at line 28 of file commandadapter.h.

Constructor & Destructor Documentation

◆ CommandAdapter()

CommandAdapter::CommandAdapter ( std::shared_ptr< AbstractItemCommand command)

Definition at line 20 of file commandadapter.cpp.

21  : m_command(std::move(command))
22 {
23 }
std::shared_ptr< AbstractItemCommand > m_command

◆ ~CommandAdapter()

CommandAdapter::~CommandAdapter ( )
overridedefault

Member Function Documentation

◆ redo()

void CommandAdapter::redo ( )
override

Definition at line 32 of file commandadapter.cpp.

33 {
34  m_command->execute();
35  setObsolete(m_command->isObsolete());
36  setText(QString::fromStdString(m_command->description()));
37 }

References m_command.

◆ undo()

void CommandAdapter::undo ( )
override

Definition at line 27 of file commandadapter.cpp.

28 {
29  m_command->undo();
30 }

References m_command.

Member Data Documentation

◆ m_command

std::shared_ptr<AbstractItemCommand> ModelView::CommandAdapter::m_command
private

Definition at line 37 of file commandadapter.h.

Referenced by redo(), and undo().


The documentation for this class was generated from the following files: