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

Description

Widget for selecting the resolution function of a detector (combo box) and input of the corresponding values.

Definition at line 26 of file ResolutionFunctionEditor.h.

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

Public Types

enum  Unit { Degree , Millimeter }
 

Signals

void dataChanged ()
 

Public Member Functions

 ResolutionFunctionEditor (Unit unit, QWidget *parent, DetectorItem *item)
 

Private Member Functions

void createResolutionWidgets ()
 

Private Attributes

QFormLayout * m_formLayout
 
DetectorItemm_item
 
Unit m_unit
 

Member Enumeration Documentation

◆ Unit

Constructor & Destructor Documentation

◆ ResolutionFunctionEditor()

ResolutionFunctionEditor::ResolutionFunctionEditor ( Unit  unit,
QWidget *  parent,
DetectorItem item 
)

Definition at line 24 of file ResolutionFunctionEditor.cpp.

25  : QGroupBox("Resolution function", parent)
26  , m_unit(unit)
27  , m_item(item)
28 {
29  ASSERT(item);
30  setProperty("subgroup", true); // for stylesheet addressing
31  m_formLayout = new QFormLayout(this);
32  m_formLayout->setFieldGrowthPolicy(QFormLayout::FieldsStayAtSizeHint);
33 
34  auto* typeCombo =
36  createResolutionWidgets();
37  emit dataChanged();
38  });
39  m_formLayout->addRow("Type:", typeCombo);
40 
42 
44 }
SelectionDescriptor< ResolutionFunctionItem * > resolutionFunctionSelection() const
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 createResolutionWidgets(), GUI::Util::createSelectionCombo(), GroupBoxCollapser::installIntoGroupBox(), m_formLayout, and DetectorItem::resolutionFunctionSelection().

Here is the call graph for this function:

Member Function Documentation

◆ createResolutionWidgets()

void ResolutionFunctionEditor::createResolutionWidgets ( )
private

Definition at line 46 of file ResolutionFunctionEditor.cpp.

47 {
48  while (m_formLayout->rowCount() > 1)
49  m_formLayout->removeRow(1);
50 
51  auto* resFunction = m_item->resolutionFunctionSelection().currentItem();
52  if (auto* p = dynamic_cast<ResolutionFunction2DGaussianItem*>(resFunction)) {
53  auto* sigmaXSpinBox = GUI::Util::createSpinBox(m_formLayout, p->sigmaX());
54  auto* sigmaYSpinBox = GUI::Util::createSpinBox(m_formLayout, p->sigmaY());
55 
56  connect(sigmaXSpinBox, qOverload<double>(&DoubleSpinBox::baseValueChanged),
57  [=](double newValue) {
58  p->setSigmaX(newValue);
59  emit dataChanged();
60  });
61 
62  connect(sigmaYSpinBox, qOverload<double>(&DoubleSpinBox::baseValueChanged),
63  [=](double newValue) {
64  p->setSigmaY(newValue);
65  emit dataChanged();
66  });
67  }
68 }
void baseValueChanged(double newBaseValue)
Emitted whenever the value changes.
QSpinBox * createSpinBox(QWidget *parent, const UIntDescriptor &d, std::function< void(uint)> slot=nullptr)
Create a spin box with the information found in a UIntDescriptor.
Definition: WidgetUtils.cpp:24

References DoubleSpinBox::baseValueChanged(), GUI::Util::createSpinBox(), dataChanged(), m_formLayout, m_item, and DetectorItem::resolutionFunctionSelection().

Referenced by ResolutionFunctionEditor().

Here is the call graph for this function:

◆ dataChanged

Member Data Documentation

◆ m_formLayout

QFormLayout* ResolutionFunctionEditor::m_formLayout
private

Definition at line 41 of file ResolutionFunctionEditor.h.

Referenced by ResolutionFunctionEditor(), and createResolutionWidgets().

◆ m_item

DetectorItem* ResolutionFunctionEditor::m_item
private

Definition at line 40 of file ResolutionFunctionEditor.h.

Referenced by createResolutionWidgets().

◆ m_unit

Unit ResolutionFunctionEditor::m_unit
private

Definition at line 39 of file ResolutionFunctionEditor.h.


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