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

Description

The form for a spherical axis: contains the bare bone widgets for the user to enter the number of bins and to select the range in degrees (minimum & maximum) The input widgets will be inserted in the form given in the constructor.

Definition at line 29 of file SphericalAxisEditor.h.

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

Signals

void dataChanged ()
 

Public Member Functions

 SphericalAxisForm (QFormLayout *form, QWidget *parent)
 
void setEnabled (bool enabled)
 
void setItem (BasicAxisItem *item)
 
void updateData ()
 Reload UI from data. More...
 

Private Slots

void onMaximumValueChanged (double value)
 
void onMinimumValueChanged (double value)
 
void onNbinsValueChanged (int value)
 

Private Attributes

BasicAxisItemm_item
 
QDoubleSpinBox * m_maximumSpinBox
 
QDoubleSpinBox * m_minimumSpinBox
 
QSpinBox * m_nbinsSpinBox
 

Constructor & Destructor Documentation

◆ SphericalAxisForm()

SphericalAxisForm::SphericalAxisForm ( QFormLayout *  form,
QWidget *  parent 
)

Definition at line 22 of file SphericalAxisEditor.cpp.

23  : QObject(parent)
24  , m_item(nullptr)
25 {
26  m_nbinsSpinBox = new QSpinBox(parent);
27  m_nbinsSpinBox->setRange(1, 65536);
28  connect(m_nbinsSpinBox, qOverload<int>(&QSpinBox::valueChanged), this,
30  form->addRow("Nbins:", m_nbinsSpinBox);
31 
32  m_minimumSpinBox = new QDoubleSpinBox(parent);
33  m_minimumSpinBox->setRange(0, 90);
34  m_minimumSpinBox->setDecimals(3);
35  m_minimumSpinBox->setSingleStep(0.01);
36  connect(m_minimumSpinBox, qOverload<double>(&QDoubleSpinBox::valueChanged), this,
38  form->addRow("Minimum [deg]:", m_minimumSpinBox);
39 
40  m_maximumSpinBox = new QDoubleSpinBox(parent);
41  m_maximumSpinBox->setRange(0, 90);
42  m_maximumSpinBox->setDecimals(3);
43  m_maximumSpinBox->setSingleStep(0.01);
44  connect(m_maximumSpinBox, qOverload<double>(&QDoubleSpinBox::valueChanged), this,
46  form->addRow("Maximum [deg]:", m_maximumSpinBox);
47 }
QDoubleSpinBox * m_maximumSpinBox
QDoubleSpinBox * m_minimumSpinBox
BasicAxisItem * m_item
void onMaximumValueChanged(double value)
void onNbinsValueChanged(int value)
void onMinimumValueChanged(double value)

References m_maximumSpinBox, m_minimumSpinBox, m_nbinsSpinBox, onMaximumValueChanged(), onMinimumValueChanged(), and onNbinsValueChanged().

Here is the call graph for this function:

Member Function Documentation

◆ dataChanged

◆ onMaximumValueChanged

void SphericalAxisForm::onMaximumValueChanged ( double  value)
privateslot

Definition at line 97 of file SphericalAxisEditor.cpp.

98 {
99  if (m_item && m_item->max() != value) {
100  m_item->setUpperBound(value);
101  emit dataChanged();
102  if (m_item->min() > value)
103  m_minimumSpinBox->setValue(value);
104  }
105 }
DoubleDescriptor min(const QString &unit=QString()) const
Definition: AxesItems.cpp:41
void setUpperBound(double value)
Definition: AxesItems.cpp:65
DoubleDescriptor max(const QString &unit=QString()) const
Definition: AxesItems.cpp:58

References dataChanged(), m_item, m_minimumSpinBox, BasicAxisItem::max(), BasicAxisItem::min(), and BasicAxisItem::setUpperBound().

Referenced by SphericalAxisForm().

Here is the call graph for this function:

◆ onMinimumValueChanged

void SphericalAxisForm::onMinimumValueChanged ( double  value)
privateslot

Definition at line 87 of file SphericalAxisEditor.cpp.

88 {
89  if (m_item && m_item->min() != value) {
90  m_item->setLowerBound(value);
91  emit dataChanged();
92  if (m_item->max() < value)
93  m_maximumSpinBox->setValue(value);
94  }
95 }
void setLowerBound(double value)
Definition: AxesItems.cpp:48

References dataChanged(), m_item, m_maximumSpinBox, BasicAxisItem::max(), BasicAxisItem::min(), and BasicAxisItem::setLowerBound().

Referenced by SphericalAxisForm().

Here is the call graph for this function:

◆ onNbinsValueChanged

void SphericalAxisForm::onNbinsValueChanged ( int  value)
privateslot

Definition at line 79 of file SphericalAxisEditor.cpp.

80 {
81  if (m_item && m_item->binCount() != value) {
82  m_item->setBinCount(value);
83  emit dataChanged();
84  }
85 }
int binCount() const
Definition: AxesItems.cpp:26
void setBinCount(size_t value)
Definition: AxesItems.cpp:31

References BasicAxisItem::binCount(), dataChanged(), m_item, and BasicAxisItem::setBinCount().

Referenced by SphericalAxisForm().

Here is the call graph for this function:

◆ setEnabled()

void SphericalAxisForm::setEnabled ( bool  enabled)

Definition at line 56 of file SphericalAxisEditor.cpp.

57 {
58  m_nbinsSpinBox->setEnabled(enabled);
59  m_minimumSpinBox->setEnabled(enabled);
60  m_maximumSpinBox->setEnabled(enabled);
61 }

References m_maximumSpinBox, m_minimumSpinBox, and m_nbinsSpinBox.

Referenced by InclinationAnglesEditor::onAxisTypeSelected(), and setItem().

◆ setItem()

void SphericalAxisForm::setItem ( BasicAxisItem item)

Definition at line 49 of file SphericalAxisEditor.cpp.

50 {
51  m_item = item;
53  updateData();
54 }
void setEnabled(bool enabled)
void updateData()
Reload UI from data.

References m_item, setEnabled(), and updateData().

Referenced by InclinationAnglesEditor::onAxisTypeSelected().

Here is the call graph for this function:

◆ updateData()

void SphericalAxisForm::updateData ( )

Reload UI from data.

Definition at line 63 of file SphericalAxisEditor.cpp.

64 {
65  QSignalBlocker b1(m_nbinsSpinBox);
66  QSignalBlocker b2(m_minimumSpinBox);
67  QSignalBlocker b3(m_maximumSpinBox);
68  if (m_item) {
69  m_nbinsSpinBox->setValue(m_item->binCount());
70  m_minimumSpinBox->setValue(m_item->min());
71  m_maximumSpinBox->setValue(m_item->max());
72  } else {
73  m_nbinsSpinBox->setValue(1);
74  m_minimumSpinBox->setValue(0.0);
75  m_maximumSpinBox->setValue(0.0);
76  }
77 }

References BasicAxisItem::binCount(), m_item, m_maximumSpinBox, m_minimumSpinBox, m_nbinsSpinBox, BasicAxisItem::max(), and BasicAxisItem::min().

Referenced by setItem(), and InclinationAnglesEditor::updateIndicators().

Here is the call graph for this function:

Member Data Documentation

◆ m_item

BasicAxisItem* SphericalAxisForm::m_item
private

◆ m_maximumSpinBox

QDoubleSpinBox* SphericalAxisForm::m_maximumSpinBox
private

◆ m_minimumSpinBox

QDoubleSpinBox* SphericalAxisForm::m_minimumSpinBox
private

◆ m_nbinsSpinBox

QSpinBox* SphericalAxisForm::m_nbinsSpinBox
private

Definition at line 48 of file SphericalAxisEditor.h.

Referenced by SphericalAxisForm(), setEnabled(), and updateData().


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