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

Updates reference curve in JobItem when BeamItem is changed. More...

Inheritance diagram for gui2::SimPlotController:
[legend]
Collaboration diagram for gui2::SimPlotController:
[legend]

Public Member Functions

 SimPlotController (QObject *parent=nullptr)
 
 ~SimPlotController ()
 
void setModels (ApplicationModels *models)
 

Private Member Functions

void onInstrumentChange ()
 

Private Attributes

std::unique_ptr< ModelView::ModelHasChangedControllerm_instrumentChangedController
 
ApplicationModelsm_models {nullptr}
 

Detailed Description

Updates reference curve in JobItem when BeamItem is changed.

Definition at line 32 of file simplotcontroller.h.

Constructor & Destructor Documentation

◆ SimPlotController()

gui2::SimPlotController::SimPlotController ( QObject *  parent = nullptr)

Definition at line 25 of file simplotcontroller.cpp.

25 : QObject(parent) {}

◆ ~SimPlotController()

gui2::SimPlotController::~SimPlotController ( )
default

Member Function Documentation

◆ onInstrumentChange()

void gui2::SimPlotController::onInstrumentChange ( )
private

Definition at line 36 of file simplotcontroller.cpp.

37 {
38  auto instrument = m_models->instrumentModel()->topItem<SpecularInstrumentItem>();
39  auto graph = instrument->beamItem()->experimentalGraphItem();
41 }
T * topItem() const
Returns top item of the given type.
Definition: sessionmodel.h:126
SpecularBeamItem * beamItem() const override
InstrumentModel * instrumentModel()
void updateReferenceGraph(const ModelView::GraphItem *graph)
Definition: jobmodel.cpp:64
ApplicationModels * m_models

References gui2::SpecularInstrumentItem::beamItem(), gui2::SpecularBeamItem::experimentalGraphItem(), gui2::ApplicationModels::instrumentModel(), gui2::ApplicationModels::jobModel(), m_models, ModelView::SessionModel::topItem(), and gui2::JobModel::updateReferenceGraph().

Referenced by setModels().

Here is the call graph for this function:

◆ setModels()

void gui2::SimPlotController::setModels ( ApplicationModels models)

Definition at line 27 of file simplotcontroller.cpp.

28 {
29  m_models = models;
30 
31  auto on_model_change = [this]() { onInstrumentChange(); };
32  m_instrumentChangedController = std::make_unique<ModelView::ModelHasChangedController>(
33  m_models->instrumentModel(), on_model_change);
34 }
std::unique_ptr< ModelView::ModelHasChangedController > m_instrumentChangedController

References gui2::ApplicationModels::instrumentModel(), m_instrumentChangedController, m_models, and onInstrumentChange().

Referenced by gui2::QuickSimEditor::setModels().

Here is the call graph for this function:

Member Data Documentation

◆ m_instrumentChangedController

std::unique_ptr<ModelView::ModelHasChangedController> gui2::SimPlotController::m_instrumentChangedController
private

Definition at line 45 of file simplotcontroller.h.

Referenced by setModels().

◆ m_models

ApplicationModels* gui2::SimPlotController::m_models {nullptr}
private

Definition at line 44 of file simplotcontroller.h.

Referenced by onInstrumentChange(), and setModels().


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