BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
RealSpaceWidget.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/coregui/Views/RealSpaceWidgets/RealSpaceWidget.cpp
6 //! @brief Implements class RealSpaceWidget
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
19 #include <QLabel>
20 #include <QVBoxLayout>
21 
22 RealSpaceWidget::RealSpaceWidget(SampleModel* sampleModel, QItemSelectionModel* selectionModel,
23  QWidget* parent)
24  : QWidget(parent)
25  , m_actions(new RealSpaceActions(this))
26  , m_toolBar(new RealSpaceToolBar)
27  , m_canvas(new RealSpaceCanvas)
28  , m_sampleModel(sampleModel)
29  , m_selectionModel(selectionModel)
30 {
31  auto hlayout = new QHBoxLayout;
32  hlayout->setMargin(0);
33  hlayout->setSpacing(0);
34  hlayout->setContentsMargins(0, 0, 0, 0);
35  hlayout->addWidget(m_canvas);
36 
37  auto* mainLayout = new QVBoxLayout;
38  mainLayout->setMargin(0);
39  mainLayout->setSpacing(0);
40  mainLayout->setContentsMargins(0, 0, 0, 0);
41  mainLayout->addWidget(m_toolBar);
42  mainLayout->addLayout(hlayout);
43 
44  setLayout(mainLayout);
45 
48 
51 
54 
57 
60 
63 }
64 
65 void RealSpaceWidget::showEvent(QShowEvent*)
66 {
68 }
69 
70 void RealSpaceWidget::hideEvent(QHideEvent*)
71 {
72  m_canvas->setModel(nullptr, nullptr);
73 }
Defines class RealSpaceActions.
Defines class RealSpaceCanvas.
Defines class RealSpaceWidget.
Defines class RealSpaceWidget.
Collection of actions for RealSpaceWidget.
Provides 3D object generation for RealSpaceWidget.
void setModel(SampleModel *sampleModel=nullptr, QItemSelectionModel *selectionModel=nullptr)
void onLockViewAction(bool view_locked)
void onChangeLayerSizeAction(double layer_size_scale)
Thin toolbar on top of RealSpaceWidget.
void changeLayerSizeAction(double)
void savePictureAction()
void defaultViewAction()
void lockViewAction(bool)
RealSpaceWidget(SampleModel *sampleModel=nullptr, QItemSelectionModel *selectionModel=nullptr, QWidget *parent=nullptr)
SampleModel * m_sampleModel
RealSpaceToolBar * m_toolBar
QItemSelectionModel * m_selectionModel
void showEvent(QShowEvent *) override
void hideEvent(QHideEvent *) override
RealSpaceCanvas * m_canvas
Main model to hold sample items.
Definition: SampleModel.h:24