BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
simplotwidget.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file gui2/quicksimeditor/simplotwidget.cpp
6 //! @brief Implements class CLASS?
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2020
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
18 #include "gui2/model/jobmodel.h"
21 #include <QList>
22 #include <QSplitter>
23 #include <QVBoxLayout>
24 
25 namespace gui2 {
26 
28  : QWidget(parent)
29  , m_specularCanvas(new ModelView::GraphCanvas)
30  , m_diffCanvas(new ModelView::GraphCanvas)
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 }
52 
54 
56 {
57  m_models = models;
60 }
61 
63 {
66 }
67 
68 } // namespace gui2
Defines class CLASS?
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)
void setItem(GraphViewportItem *viewport_item)
void setViewportToContent(double left, double top, double right, double bottom)
Main class to holds all models of GUI session.
ModelView::GraphViewportItem * diffViewport() const
Definition: jobmodel.cpp:59
CanvasItem * specularViewport() const
Definition: jobmodel.cpp:54
SimPlotWidget(QWidget *parent=nullptr)
ModelView::GraphCanvas * m_specularCanvas
Definition: simplotwidget.h:47
ModelView::GraphCanvas * m_diffCanvas
Definition: simplotwidget.h:48
ApplicationModels * m_models
Definition: simplotwidget.h:46
void setModels(ApplicationModels *models)
Defines class CLASS?
Defines class CLASS?
Defines class CLASS?
Defines class CLASS?
materialitems.h Collection of materials to populate MaterialModel.
Based on Qt example "codeeditor" Copyright (C) 2016 The Qt Company Ltd.
Definition: app_constants.h:20
Defines class CLASS?