BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
widget.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/ba3d/widget.cpp
6 //! @brief Implement Widget 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 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #include "GUI/ba3d/widget.h"
16 #include "GUI/ba3d/model/model.h"
17 #include "GUI/ba3d/view/canvas.h"
18 #include "GUI/ba3d/view/program.h"
19 
20 #include <QBoxLayout>
21 
22 namespace RealSpace {
23 //------------------------------------------------------------------------------
24 
25 Widget3D::Widget3D() : canvas(nullptr)
26 {
27  auto box = new QHBoxLayout;
28  setLayout(box);
29  box->setMargin(0);
30  box->addWidget((canvas = new Canvas));
31 }
32 
33 Widget3D::~Widget3D() = default;
34 
36 {
37  return *canvas->cam();
38 }
39 
40 void Widget3D::setBackground(QColor const& color)
41 {
42  canvas->setBgColor(color);
43 }
44 
46 {
48 }
49 
51 {
53 }
54 
56 {
57  canvas->sideView();
58 }
59 
61 {
62  canvas->topView();
63 }
64 
66 {
67  return canvas->getModel();
68 }
69 
70 //------------------------------------------------------------------------------
71 } // namespace RealSpace
Defines Canvas class.
Model * getModel()
Definition: canvas.cpp:110
void setBgColor(QColor const &)
Definition: canvas.cpp:70
Camera * cam()
Definition: canvas.h:59
void defaultView()
Definition: canvas.cpp:315
void setModel(Model *)
Definition: canvas.cpp:92
Canvas * canvas
Definition: widget.h:47
Model * model()
Definition: widget.cpp:65
void setModel(Model *)
Definition: widget.cpp:45
Camera & cam()
Definition: widget.cpp:35
void setBackground(QColor const &)
Definition: widget.cpp:40
void defaultView()
Definition: widget.cpp:50
Defines Model class.
Defines Program class.
Defines Widget class.