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

Description

FootprintCorrection editor (i.e. background) for instrument editors. Operates on InstrumentItem.

Definition at line 26 of file FootprintCorrectionEditor.h.

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

Signals

void dataChanged ()
 

Public Member Functions

 FootprintCorrectionEditor (QWidget *parent, SpecularBeamItem *item)
 

Private Member Functions

void createFootprintWidgets ()
 

Private Attributes

QFormLayout * m_formLayout
 
SpecularBeamItemm_item
 

Constructor & Destructor Documentation

◆ FootprintCorrectionEditor()

FootprintCorrectionEditor::FootprintCorrectionEditor ( QWidget *  parent,
SpecularBeamItem item 
)

Definition at line 23 of file FootprintCorrectionEditor.cpp.

24  : QGroupBox("Footprint correction", parent)
25  , m_item(item)
26 {
27  ASSERT(item);
28  setProperty("subgroup", true); // for stylesheet addressing
29  m_formLayout = new QFormLayout(this);
30  m_formLayout->setFieldGrowthPolicy(QFormLayout::FieldsStayAtSizeHint);
31  auto* typeCombo = GUI::Util::createSelectionCombo(this, item->footprintSelection(), [=](int) {
32  createFootprintWidgets();
33  emit dataChanged();
34  });
35  m_formLayout->addRow("Type:", typeCombo);
36 
38 
40 }
static GroupBoxCollapser * installIntoGroupBox(QGroupBox *groupBox, bool expanded=true)
SelectionDescriptor< FootprintItem * > footprintSelection() const
Definition: BeamItems.cpp:166
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 createFootprintWidgets(), GUI::Util::createSelectionCombo(), SpecularBeamItem::footprintSelection(), GroupBoxCollapser::installIntoGroupBox(), and m_formLayout.

Here is the call graph for this function:

Member Function Documentation

◆ createFootprintWidgets()

void FootprintCorrectionEditor::createFootprintWidgets ( )
private

Definition at line 42 of file FootprintCorrectionEditor.cpp.

43 {
44  while (m_formLayout->rowCount() > 1)
45  m_formLayout->removeRow(1);
46 
47  auto* footprintItem = m_item->footprintSelection().currentItem();
48  if (auto* square = dynamic_cast<FootprintSquareItem*>(footprintItem)) {
49  auto* spinbox = new DoubleSpinBox(this, square->squareFootprintValue());
50  spinbox->setSingleStep(0.01);
51  m_formLayout->addRow("Width ratio:", spinbox);
52  connect(spinbox, qOverload<double>(&DoubleSpinBox::baseValueChanged), [=](double newValue) {
53  square->setSquareFootprintValue(newValue);
54  emit dataChanged();
55  });
56  } else if (auto* gauss = dynamic_cast<FootprintGaussianItem*>(footprintItem)) {
57  auto* spinbox = new DoubleSpinBox(this, gauss->gaussianFootprintValue());
58  spinbox->setSingleStep(0.01);
59  m_formLayout->addRow("Width ratio:", spinbox);
60  connect(spinbox, qOverload<double>(&DoubleSpinBox::baseValueChanged), [=](double newValue) {
61  gauss->setGaussianFootprintValue(newValue);
62  emit dataChanged();
63  });
64  }
65 }
SpinBox for DoubleDescriptors, supporting units.
Definition: DoubleSpinBox.h:22
void baseValueChanged(double newBaseValue)
Emitted whenever the value changes.

References DoubleSpinBox::baseValueChanged(), dataChanged(), SpecularBeamItem::footprintSelection(), m_formLayout, and m_item.

Referenced by FootprintCorrectionEditor().

Here is the call graph for this function:

◆ dataChanged

void FootprintCorrectionEditor::dataChanged ( )
signal

Member Data Documentation

◆ m_formLayout

QFormLayout* FootprintCorrectionEditor::m_formLayout
private

◆ m_item

SpecularBeamItem* FootprintCorrectionEditor::m_item
private

Definition at line 40 of file FootprintCorrectionEditor.h.

Referenced by createFootprintWidgets().


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