BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
RealSpacePanel Class Reference

Description

Panel to show 3D view of sample. Contains toolbar and RealSpaceCanvas.

Definition at line 24 of file RealSpacePanel.h.

Inheritance diagram for RealSpacePanel:
[legend]
Collaboration diagram for RealSpacePanel:
[legend]

Public Member Functions

 RealSpacePanel (QWidget *parent)
 
RealSpaceCanvascanvas ()
 
QSize sizeHint () const override
 

Private Attributes

RealSpaceCanvasm_canvas
 

Constructor & Destructor Documentation

◆ RealSpacePanel()

RealSpacePanel::RealSpacePanel ( QWidget *  parent)

Definition at line 20 of file RealSpacePanel.cpp.

21  : QWidget(parent)
23 {
24  setWindowTitle("Real Space");
25 
26  auto* toolbar = new StyledToolbar(this);
27 
28  const auto createAction = [&](const QString& text, const QString& tooltip) -> QAction* {
29  auto* action = new QAction(text, this);
30  action->setToolTip(tooltip);
31  if (!toolbar->actions().empty())
32  toolbar->addSeparator();
33  toolbar->addAction(action);
34  return action;
35  };
36 
37  auto* action = createAction("Save Picture", "Save 3D real space view as .png file");
38  connect(action, &QAction::triggered, m_canvas, QOverload<>::of(&RealSpaceCanvas::savePicture));
39 
40  action = createAction("Default View", "Reset view and zoom level to default");
41  connect(action, &QAction::triggered, m_canvas, &RealSpaceCanvas::defaultView);
42 
43  action = createAction("Side View", "View sample from the side at current zoom level");
44  connect(action, &QAction::triggered, m_canvas, &RealSpaceCanvas::sideView);
45 
46  action = createAction("Top View", "View sample from the top at current zoom level");
47  connect(action, &QAction::triggered, m_canvas, &RealSpaceCanvas::topView);
48 
49  action = createAction("Enlarge", "Increase layer size");
50  connect(action, &QAction::triggered, [this]() { m_canvas->changeLayerSize(1.25); });
51 
52  action = createAction("Reduce", "Decrease layer size");
53  connect(action, &QAction::triggered, [this]() { m_canvas->changeLayerSize(0.8); });
54 
55  auto* mainLayout = new QVBoxLayout(this);
56  mainLayout->setMargin(0);
57  mainLayout->setSpacing(0);
58  mainLayout->setContentsMargins(0, 0, 0, 0);
59  mainLayout->addWidget(toolbar);
60  mainLayout->addWidget(m_canvas);
61 }
Provides 3D object generation for RealSpace presentation.
void changeLayerSize(double layerSizeChangeScale)
RealSpaceCanvas * m_canvas
The StyledToolbar class represents our standard narrow toolbar with the height 24 pixels.
Definition: StyledToolbar.h:22

References RealSpaceCanvas::changeLayerSize(), RealSpaceCanvas::defaultView(), m_canvas, RealSpaceCanvas::savePicture(), RealSpaceCanvas::sideView(), and RealSpaceCanvas::topView().

Here is the call graph for this function:

Member Function Documentation

◆ canvas()

RealSpaceCanvas * RealSpacePanel::canvas ( )

Definition at line 68 of file RealSpacePanel.cpp.

69 {
70  return m_canvas;
71 }

References m_canvas.

Referenced by SampleView::SampleView(), SampleView::onAboutToRemoveItem(), and SampleView::onRequestViewInRealSpace().

◆ sizeHint()

QSize RealSpacePanel::sizeHint ( ) const
override

Definition at line 63 of file RealSpacePanel.cpp.

64 {
65  return QSize(300, 300);
66 }

Member Data Documentation

◆ m_canvas

RealSpaceCanvas* RealSpacePanel::m_canvas
private

Definition at line 34 of file RealSpacePanel.h.

Referenced by RealSpacePanel(), and canvas().


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