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

Description

Specular beam editor. Operates on SpecularBeamItem.

Definition at line 25 of file SpecularBeamEditor.h.

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

Signals

void dataChanged ()
 

Public Member Functions

 SpecularBeamEditor (QWidget *parent, SpecularBeamItem *item, InstrumentEditController *ec)
 

Constructor & Destructor Documentation

◆ SpecularBeamEditor()

SpecularBeamEditor::SpecularBeamEditor ( QWidget *  parent,
SpecularBeamItem item,
InstrumentEditController ec 
)

Definition at line 30 of file SpecularBeamEditor.cpp.

32  : QGroupBox("Beam parameters", parent)
33 {
34  ASSERT(item);
35 
36  auto* vLayout = new QVBoxLayout(this);
37  vLayout->setContentsMargins(30, 8, 0, 0);
38  auto* form = new QFormLayout();
39  form->setFieldGrowthPolicy(QFormLayout::FieldsStayAtSizeHint);
40  vLayout->addLayout(form);
41  auto* intensityLineEdit = new QLineEdit(this);
42  intensityLineEdit->setToolTip("Beam intensity in neutrons (or gammas per second.");
43  auto* validator = new FixupDoubleValidator(intensityLineEdit);
44  validator->setNotation(QDoubleValidator::ScientificNotation);
45  validator->setRange(0.0, 1e+32, 1000);
46  intensityLineEdit->setValidator(validator);
47  form->addRow("Intensity:", intensityLineEdit);
48 
49  auto* wavelengthEditor =
51  this, item->wavelengthItem());
52  vLayout->addWidget(wavelengthEditor);
53 
54  auto* inclinationEditor = new InclinationAnglesEditor(this, item->inclinationAngleItem());
55  vLayout->addWidget(inclinationEditor);
56 
57  auto* footprintEditor = new FootprintCorrectionEditor(this, item);
58  vLayout->addWidget(footprintEditor);
59 
60  intensityLineEdit->setText(QString::number(item->intensity()));
61 
63 
64  // order of the next two connections is important! Indicators have to be recalculated first,
65  // then updated (recalculation is done in EditController)
66  connect(wavelengthEditor, &DistributionEditor::distributionChanged, ec,
68  connect(wavelengthEditor, &DistributionEditor::distributionChanged, inclinationEditor,
70 
71  // order of the next two connections is important! Wavelength has to be recalculated first,
72  // then updated (recalculation is done in EditController)
73  connect(inclinationEditor, &InclinationAnglesEditor::dataChanged, ec,
75  connect(inclinationEditor, &InclinationAnglesEditor::dataChanged, wavelengthEditor,
77 
78  connect(footprintEditor, &FootprintCorrectionEditor::dataChanged, this,
80 
81  // validate value while typing
82  connect(intensityLineEdit, &QLineEdit::textEdited, [=]() {
83  QString str = intensityLineEdit->text();
84  int pos;
85  if (intensityLineEdit->validator()->validate(str, pos) == QValidator::Acceptable) {
86  item->setIntensity(intensityLineEdit->text().toDouble());
87  emit dataChanged();
88  }
89  });
90  // if validator does not assert the input value, it says about that,
91  // and here we return to the last correct value
92  connect(validator, &FixupDoubleValidator::fixupSignal, [=]() {
93  auto* editor = qobject_cast<QLineEdit*>(validator->parent());
94  editor->setText(QString::number(item->intensity(), 'g'));
95  });
96 }
BeamWavelengthItem * wavelengthItem() const
Definition: BeamItems.cpp:67
DistributionSelector as above but contained in a GroupBox with a title and a button to open the distr...
void updateData()
Update UI from data.
void distributionChanged()
The FixupDoubleValidator class is a derivative of QDoubleValidator with non-empty "fixup" method....
void fixupSignal() const
FootprintCorrection editor (i.e. background) for instrument editors. Operates on InstrumentItem.
static GroupBoxCollapser * installIntoGroupBox(QGroupBox *groupBox, bool expanded=true)
Editor for the case where there is no single inclination angle.
void notifyWavelengthDistributionChanged()
Update dependent data and emit a changed signal.
void notifyInclinationAxisChanged()
Update dependent data and emit a changed signal.
SpecularBeamInclinationItem * inclinationAngleItem() const override
Definition: BeamItems.cpp:151
configuration to control how the user can enter a mean value

References FootprintCorrectionEditor::dataChanged(), InclinationAnglesEditor::dataChanged(), dataChanged(), DistributionEditor::distributionChanged(), FixupDoubleValidator::fixupSignal(), SpecularBeamItem::inclinationAngleItem(), GroupBoxCollapser::installIntoGroupBox(), InstrumentEditController::notifyInclinationAxisChanged(), InstrumentEditController::notifyWavelengthDistributionChanged(), GUI::ID::Symmetric, DistributionEditor::updateData(), InclinationAnglesEditor::updateIndicators(), and BeamItem::wavelengthItem().

Here is the call graph for this function:

Member Function Documentation

◆ dataChanged

void SpecularBeamEditor::dataChanged ( )
signal

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