BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
SphericalDetectorEditor.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/SphericalDetectorEditor.cpp
6 //! @brief Implement class SphericalDetectorEditor
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 <QGridLayout>
20 
21 namespace {
22 const QString phi_axis_title = "Phi axis";
23 const QString alpha_axis_title = "Alpha axis";
24 const QString resolution_title = "Resolution function";
25 const QString polarization_title = "Analyzer orientation";
26 } // namespace
27 
29  : SessionItemWidget(parent)
30  , m_phiAxisEditor(new ComponentEditor(ComponentEditor::GroupWidget, phi_axis_title))
31  , m_alphaAxisEditor(new ComponentEditor(ComponentEditor::GroupWidget, alpha_axis_title))
32  , m_resolutionFunctionEditor(
33  new ComponentEditor(ComponentEditor::GroupWidget, resolution_title))
34  , m_gridLayout(new QGridLayout)
35 {
36  m_gridLayout->addWidget(m_phiAxisEditor, 1, 0);
37  m_gridLayout->addWidget(m_alphaAxisEditor, 1, 1);
38  m_gridLayout->addWidget(m_resolutionFunctionEditor, 1, 2);
39 
40  auto mainLayout = new QVBoxLayout;
41  mainLayout->setContentsMargins(0, 0, 0, 0);
42  mainLayout->addLayout(m_gridLayout);
43  mainLayout->addStretch();
44  setLayout(mainLayout);
45 }
46 
48 {
49  auto phiAxisItem = detectorItem()->phiAxisItem();
50  m_phiAxisEditor->setItem(phiAxisItem);
51 
52  auto alphaAxisItem = detectorItem()->alphaAxisItem();
53  m_alphaAxisEditor->setItem(alphaAxisItem);
54 
56  m_resolutionFunctionEditor->setItem(resFuncGroup);
57 }
58 
60 {
64 }
65 
67 {
68  auto result = dynamic_cast<SphericalDetectorItem*>(currentItem());
69  ASSERT(result);
70  return result;
71 }
#define ASSERT(condition)
Definition: Assert.h:31
Defines various axis items.
Defines ComponentEditor class.
Defines class SphericalDetectorEditor.
Defines class SphericalDetectorItem.
Component editor for SessionItem.
void setItem(SessionItem *item)
static const QString P_RESOLUTION_FUNCTION
Definition: DetectorItems.h:28
The SessionItemWidget class is a base for all widgets representing the content of SessionItem.
SessionItem * currentItem()
SessionItem * getItem(const QString &tag="", int row=0) const
Returns item in given row of given tag.
SphericalDetectorEditor(QWidget *parent=nullptr)
ComponentEditor * m_resolutionFunctionEditor
ComponentEditor * m_alphaAxisEditor
SphericalDetectorItem * detectorItem()
const BasicAxisItem * alphaAxisItem() const
const BasicAxisItem * phiAxisItem() const