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

Description

Contains stack of detector editors and the logic to show proper editor for certain type of detector item (SphericalDetectorEditor or RectangularDetectorEditor).

Definition at line 26 of file DetectorEditor.h.

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

Signals

void dataChanged ()
 

Public Member Functions

 DetectorEditor (QWidget *parent, Instrument2DItem *item)
 

Private Member Functions

void createDetectorWidgets ()
 

Private Attributes

QFormLayout * m_formLayout
 
Instrument2DItemm_instrument
 

Constructor & Destructor Documentation

◆ DetectorEditor()

DetectorEditor::DetectorEditor ( QWidget *  parent,
Instrument2DItem item 
)

Definition at line 26 of file DetectorEditor.cpp.

27  : QGroupBox("Detector parameters", parent)
28  , m_instrument(instrument)
29 {
30  ASSERT(instrument);
31  m_formLayout = new QFormLayout(this);
32 
33  auto* detectorTypeCombo =
34  GUI::Util::createSelectionCombo(this, instrument->detectorSelection(), [=](int) {
35  createDetectorWidgets();
36  emit dataChanged();
37  });
38  m_formLayout->addRow("Detector:", detectorTypeCombo);
39 
41 
43 }
void createDetectorWidgets()
QFormLayout * m_formLayout
Instrument2DItem * m_instrument
static GroupBoxCollapser * installIntoGroupBox(QGroupBox *groupBox, bool expanded=true)
QComboBox * createSelectionCombo(QWidget *parent, const SelectionDescriptor< T > d, std::function< void(int)> slot=nullptr)
Create a combo box with the information found in a selection descriptor.
Definition: WidgetUtils.h:45

References createDetectorWidgets(), GUI::Util::createSelectionCombo(), Instrument2DItem::detectorSelection(), GroupBoxCollapser::installIntoGroupBox(), and m_formLayout.

Here is the call graph for this function:

Member Function Documentation

◆ createDetectorWidgets()

void DetectorEditor::createDetectorWidgets ( )
private

Definition at line 45 of file DetectorEditor.cpp.

46 {
47  while (m_formLayout->rowCount() > 1)
48  m_formLayout->removeRow(1);
49 
50  auto* detectorItem = m_instrument->detectorSelection().currentItem();
51  if (auto* rect = dynamic_cast<RectangularDetectorItem*>(detectorItem)) {
52  auto* editor = new RectangularDetectorEditor(this, rect);
53  m_formLayout->addRow(editor);
54  connect(editor, &RectangularDetectorEditor::dataChanged, this,
56  } else if (auto* spher = dynamic_cast<SphericalDetectorItem*>(detectorItem)) {
57  auto* editor = new SphericalDetectorEditor(this, spher);
58  m_formLayout->addRow(editor);
60  } else
61  ASSERT(false);
62 }
void dataChanged()
SelectionDescriptor< DetectorItem * > detectorSelection() const

References dataChanged(), RectangularDetectorEditor::dataChanged(), SphericalDetectorEditor::dataChanged(), Instrument2DItem::detectorSelection(), m_formLayout, and m_instrument.

Referenced by DetectorEditor().

Here is the call graph for this function:

◆ dataChanged

Member Data Documentation

◆ m_formLayout

QFormLayout* DetectorEditor::m_formLayout
private

Definition at line 39 of file DetectorEditor.h.

Referenced by DetectorEditor(), and createDetectorWidgets().

◆ m_instrument

Instrument2DItem* DetectorEditor::m_instrument
private

Definition at line 38 of file DetectorEditor.h.

Referenced by createDetectorWidgets().


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