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

Description

Editor for the case where there is no single inclination angle.

Definition at line 28 of file InclinationAnglesEditor.h.

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

Signals

void dataChanged ()
 

Public Member Functions

 InclinationAnglesEditor (QWidget *parent, SpecularBeamInclinationItem *item)
 
void updateIndicators ()
 

Private Slots

void onAxisTypeSelected (int index)
 
void updatePlot ()
 

Private Attributes

SphericalAxisFormm_form
 
SpecularBeamInclinationItemm_item
 
DistributionPlotm_plot
 
DistributionSelectorm_selector
 

Constructor & Destructor Documentation

◆ InclinationAnglesEditor()

InclinationAnglesEditor::InclinationAnglesEditor ( QWidget *  parent,
SpecularBeamInclinationItem item 
)

Definition at line 25 of file InclinationAnglesEditor.cpp.

26  : QGroupBox("Inclination angles [deg]", parent)
27  , m_item(item)
28 {
29  setProperty("subgroup", true); // for stylesheet addressing
30 
31  auto* hLayout = new QHBoxLayout(this);
32  hLayout->setSpacing(50);
33  auto* gform = new QFormLayout;
34  gform->setSpacing(6);
35  hLayout->addLayout(gform);
36 
37  m_selector =
39  gform->addRow(m_selector);
40 
41  auto* typeComboBox = new QComboBox(this);
42  typeComboBox->addItem("Uniform axis");
43  typeComboBox->addItem("Non-uniform axis");
44  gform->addRow("Axis type:", typeComboBox);
45  connect(typeComboBox, qOverload<int>(&QComboBox::currentIndexChanged), this,
47 
48  m_form = new SphericalAxisForm(gform, this);
49 
50  const int idx = m_item->pointwiseAlphaAxisSelected() ? 1 : 0;
51  ASSERT(idx != -1);
52  if (idx != typeComboBox->currentIndex())
53  typeComboBox->setCurrentIndex(idx);
54  else
55  onAxisTypeSelected(idx); // trigger update manually
56  typeComboBox->setEnabled(m_item->pointwiseAlphaAxisDefined());
57 
58  m_plot = new DistributionPlot(this);
59  m_plot->setFixedSize(280, 170);
60  m_plot->setShowMouseCoords(false);
61  hLayout->addWidget(m_plot);
62  hLayout->setAlignment(m_plot, Qt::AlignTop);
63  hLayout->addStretch(1);
64 
66 
72 
73  updatePlot();
74 }
The DistributionPlot class plots 1d functions corresponding to domain's Distribution1D.
void setShowMouseCoords(bool b)
Widget for selecting a distribution (combo box) and input of the corresponding values with respect to...
static GroupBoxCollapser * installIntoGroupBox(QGroupBox *groupBox, bool expanded=true)
SpecularBeamInclinationItem * m_item
DistributionSelector * m_selector
bool pointwiseAlphaAxisDefined() const
True if a pointwise axis was defined.
bool pointwiseAlphaAxisSelected() const
True if pointwise axis is selected.
The form for a spherical axis: contains the bare bone widgets for the user to enter the number of bin...

References dataChanged(), SphericalAxisForm::dataChanged(), DistributionSelector::distributionChanged(), GroupBoxCollapser::installIntoGroupBox(), m_form, m_item, m_plot, m_selector, onAxisTypeSelected(), SpecularBeamInclinationItem::pointwiseAlphaAxisDefined(), SpecularBeamInclinationItem::pointwiseAlphaAxisSelected(), DistributionPlot::setShowMouseCoords(), GUI::ID::Symmetric, and updatePlot().

Here is the call graph for this function:

Member Function Documentation

◆ dataChanged

◆ onAxisTypeSelected

void InclinationAnglesEditor::onAxisTypeSelected ( int  index)
privateslot

Definition at line 81 of file InclinationAnglesEditor.cpp.

82 {
83  if (m_item) {
84  if (index == 0 && m_item->pointwiseAlphaAxisSelected()) {
86  emit dataChanged();
87  } else if (index == 1 && !m_item->pointwiseAlphaAxisSelected()) {
89  emit dataChanged();
90  }
91 
93  m_form->setEnabled(index == 0);
94  }
95 }
BasicAxisItem * alphaAxis() const
The currently selected axis.
void setEnabled(bool enabled)
void setItem(BasicAxisItem *item)

References SpecularBeamInclinationItem::alphaAxis(), dataChanged(), m_form, m_item, SpecularBeamInclinationItem::pointwiseAlphaAxisSelected(), SpecularBeamInclinationItem::selectPointwiseAxis(), SpecularBeamInclinationItem::selectUniformAxis(), SphericalAxisForm::setEnabled(), and SphericalAxisForm::setItem().

Referenced by InclinationAnglesEditor().

Here is the call graph for this function:

◆ updateIndicators()

void InclinationAnglesEditor::updateIndicators ( )

Definition at line 76 of file InclinationAnglesEditor.cpp.

77 {
78  m_form->updateData();
79 }
void updateData()
Reload UI from data.

References m_form, and SphericalAxisForm::updateData().

Referenced by SpecularBeamEditor::SpecularBeamEditor().

Here is the call graph for this function:

◆ updatePlot

void InclinationAnglesEditor::updatePlot ( )
privateslot

Definition at line 97 of file InclinationAnglesEditor.cpp.

98 {
99  auto* d = m_selector->item()->distribution();
100  m_plot->setVisible(!dynamic_cast<const DistributionNoneItem*>(d));
101  m_plot->setItem(d);
102  m_plot->plotItem();
103 }
DistributionItem * distribution() const
void setItem(DistributionItem *item)
BeamDistributionItem * item() const

References BeamDistributionItem::distribution(), DistributionSelector::item(), m_plot, m_selector, DistributionPlot::plotItem(), and DistributionPlot::setItem().

Referenced by InclinationAnglesEditor().

Here is the call graph for this function:

Member Data Documentation

◆ m_form

SphericalAxisForm* InclinationAnglesEditor::m_form
private

◆ m_item

SpecularBeamInclinationItem* InclinationAnglesEditor::m_item
private

Definition at line 45 of file InclinationAnglesEditor.h.

Referenced by InclinationAnglesEditor(), and onAxisTypeSelected().

◆ m_plot

DistributionPlot* InclinationAnglesEditor::m_plot
private

Definition at line 46 of file InclinationAnglesEditor.h.

Referenced by InclinationAnglesEditor(), and updatePlot().

◆ m_selector

DistributionSelector* InclinationAnglesEditor::m_selector
private

Definition at line 43 of file InclinationAnglesEditor.h.

Referenced by InclinationAnglesEditor(), and updatePlot().


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