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

Presents simulation results together with reference experimental data on two canvas. More...

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

Public Member Functions

 SimPlotWidget (QWidget *parent=nullptr)
 
 ~SimPlotWidget ()
 
void setModels (ApplicationModels *models)
 
void updateDiffPlot ()
 
void updateViewport ()
 

Private Attributes

ModelView::GraphCanvasm_diffCanvas {nullptr}
 
ApplicationModelsm_models {nullptr}
 
ModelView::GraphCanvasm_specularCanvas {nullptr}
 

Detailed Description

Presents simulation results together with reference experimental data on two canvas.

The top canvas contains graphs itself, bottom canvas their relative difference.

Definition at line 32 of file simplotwidget.h.

Constructor & Destructor Documentation

◆ SimPlotWidget()

gui2::SimPlotWidget::SimPlotWidget ( QWidget *  parent = nullptr)

Definition at line 27 of file simplotwidget.cpp.

28  : QWidget(parent)
31 {
32  auto layout = new QVBoxLayout(this);
33  layout->setContentsMargins(0, 5, 5, 5);
34 
35  auto splitter = new QSplitter;
36  splitter->setOrientation(Qt::Vertical);
37 
38  splitter->addWidget(m_specularCanvas);
39  splitter->addWidget(m_diffCanvas);
40 
41  // splitter->setStyleSheet("background-color:white;");
42  splitter->setSizes(QList<int>() << 300 << 100);
43 
44  layout->addWidget(splitter);
45 
46  auto on_axis_margins = [this](int left, int, int right, int) {
47  // syncronizes left and right margins, leave top and bottom automatic
48  m_diffCanvas->setAxisMargins(left, -1, right, -1);
49  };
51 }
Widget to show scientific figure with multiple 1D graphs.
Definition: graphcanvas.h:30
void setAxisMargins(int left, int top, int right, int bottom)
Set margins between axes rectangle and widget borders.
void axisMarginsChanged(int left, int top, int right, int bottom)
ModelView::GraphCanvas * m_specularCanvas
Definition: simplotwidget.h:47
ModelView::GraphCanvas * m_diffCanvas
Definition: simplotwidget.h:48

References ModelView::GraphCanvas::axisMarginsChanged(), m_diffCanvas, m_specularCanvas, and ModelView::GraphCanvas::setAxisMargins().

Here is the call graph for this function:

◆ ~SimPlotWidget()

gui2::SimPlotWidget::~SimPlotWidget ( )
default

Member Function Documentation

◆ setModels()

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

Definition at line 55 of file simplotwidget.cpp.

56 {
57  m_models = models;
60 }
void setItem(GraphViewportItem *viewport_item)
ModelView::GraphViewportItem * diffViewport() const
Definition: jobmodel.cpp:59
CanvasItem * specularViewport() const
Definition: jobmodel.cpp:54
ApplicationModels * m_models
Definition: simplotwidget.h:46

References gui2::JobModel::diffViewport(), gui2::ApplicationModels::jobModel(), m_diffCanvas, m_models, m_specularCanvas, ModelView::GraphCanvas::setItem(), and gui2::JobModel::specularViewport().

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

Here is the call graph for this function:

◆ updateDiffPlot()

void gui2::SimPlotWidget::updateDiffPlot ( )

◆ updateViewport()

void gui2::SimPlotWidget::updateViewport ( )

Definition at line 62 of file simplotwidget.cpp.

63 {
66 }
void setViewportToContent(double left, double top, double right, double bottom)

References m_diffCanvas, m_specularCanvas, and ModelView::GraphCanvas::setViewportToContent().

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

Here is the call graph for this function:

Member Data Documentation

◆ m_diffCanvas

ModelView::GraphCanvas* gui2::SimPlotWidget::m_diffCanvas {nullptr}
private

Definition at line 48 of file simplotwidget.h.

Referenced by SimPlotWidget(), setModels(), and updateViewport().

◆ m_models

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

Definition at line 46 of file simplotwidget.h.

Referenced by setModels().

◆ m_specularCanvas

ModelView::GraphCanvas* gui2::SimPlotWidget::m_specularCanvas {nullptr}
private

Definition at line 47 of file simplotwidget.h.

Referenced by SimPlotWidget(), setModels(), and updateViewport().


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