BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
PolarizationAnalysisEditor.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/coregui/Views/InstrumentWidgets/PolarizationAnalysisEditor.cpp
6 //! @brief Implements class PolarizationAnalysisEditor
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 
21 #include <QGridLayout>
22 #include <QSpacerItem>
23 
24 namespace {
25 const QString beam_pol_title("Polarization (Bloch vector)");
26 const QString analyzer_orientation_title = "Analyzer orientation";
27 const QString analyzer_properties_title = "Analyzer properties";
28 } // namespace
29 
31  QWidget* parent)
32  : SessionItemWidget(parent)
33  , m_columnResizer(columnResizer)
34  , m_polarizationEditor(new ComponentEditor(ComponentEditor::GroupWidget, beam_pol_title))
35  , m_analyserDirectionEditor(
36  new ComponentEditor(ComponentEditor::GroupWidget, analyzer_orientation_title))
37  , m_analyserPropertiesEditor(
38  new ComponentEditor(ComponentEditor::GroupWidget, analyzer_properties_title))
39  , m_gridLayout(new QGridLayout)
40 {
41  m_gridLayout->addWidget(m_polarizationEditor, 0, 0);
42  m_gridLayout->addWidget(m_analyserDirectionEditor, 0, 1);
43  m_gridLayout->addWidget(m_analyserPropertiesEditor, 0, 2);
44 
45  auto mainLayout = new QVBoxLayout;
46  mainLayout->addLayout(m_gridLayout);
47  mainLayout->addStretch();
48  setLayout(mainLayout);
49 
53 }
54 
56 {
58 
60  [this](const QString& name) {
63  },
64  this);
65 
67 }
68 
70 {
74 }
75 
77 {
78  auto result = dynamic_cast<GISASInstrumentItem*>(currentItem());
79  ASSERT(result);
80  return result;
81 }
82 
84 {
85  return instrumentItem()->beamItem();
86 }
87 
89 {
90  return instrumentItem()->detectorItem();
91 }
92 
93 //! Updates analyser editor to display properties of currently selected detector
94 //! (spherical/rectangular).
95 
97 {
105 }
#define ASSERT(condition)
Definition: Assert.h:31
Defines class ColumnResizer.
Defines ComponentEditor class.
Defines classes DetectorItems.
Defines InstrumentItems classes.
Defines LayoutUtils namespace.
Defines class PolarizationAnalysisEditor.
static const QString P_POLARIZATION
Definition: BeamItems.h:32
The ColumnResizer class provides vertically aligned widgets from diferent layouts.
Definition: ColumnResizer.h:37
void addWidgetsFromGridLayout(QGridLayout *, int column)
Component editor for SessionItem.
void addItem(SessionItem *item)
void setItem(SessionItem *item)
static const QString P_ANALYZER_EFFICIENCY
Definition: DetectorItems.h:30
static const QString P_ANALYZER_DIRECTION
Definition: DetectorItems.h:29
static const QString P_ANALYZER_TOTAL_TRANSMISSION
Definition: DetectorItems.h:31
DetectorItem * detectorItem() const
static const QString P_DETECTOR
virtual BeamItem * beamItem() const
void setOnPropertyChange(std::function< void(QString)> f, const void *caller=0)
Definition: ModelMapper.cpp:35
PolarizationAnalysisEditor(ColumnResizer *columnResizer, QWidget *parent=nullptr)
GISASInstrumentItem * instrumentItem()
void updateAnalyserEditor()
Updates analyser editor to display properties of currently selected detector (spherical/rectangular).
The SessionItemWidget class is a base for all widgets representing the content of SessionItem.
SessionItem * currentItem()
ModelMapper * mapper()
Returns the current model mapper of this item. Creates new one if necessary.
QString const & name(EShape k)
Definition: particles.cpp:21