25 #include <QDoubleValidator>
26 #include <QFormLayout>
27 #include <QGridLayout>
32 : QGroupBox(
"Beam parameters", parent)
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.");
44 validator->setNotation(QDoubleValidator::ScientificNotation);
45 validator->setRange(0.0, 1e+32, 1000);
46 intensityLineEdit->setValidator(validator);
47 form->addRow(
"Intensity:", intensityLineEdit);
49 auto* wavelengthEditor =
52 vLayout->addWidget(wavelengthEditor);
55 vLayout->addWidget(inclinationEditor);
58 vLayout->addWidget(footprintEditor);
60 intensityLineEdit->setText(QString::number(item->intensity()));
82 connect(intensityLineEdit, &QLineEdit::textEdited, [=]() {
83 QString str = intensityLineEdit->text();
85 if (intensityLineEdit->validator()->validate(str, pos) == QValidator::Acceptable) {
86 item->setIntensity(intensityLineEdit->text().toDouble());
93 auto* editor = qobject_cast<QLineEdit*>(validator->parent());
94 editor->setText(QString::number(item->intensity(),
'g'));
Defines BeamItem hierarchy.
Defines class BeamWavelengthItem.
A widget for selecting a distribution and setting its parameters.
Defines class DoubleDescriptor.
Defines class FixupDoubleValidator.
Defines class GroupBoxCollapser.
Defines class InclinationAnglesEditor.
Defines class InstrumentEditController.
Defines class SpecularBeamEditor.
BeamWavelengthItem * wavelengthItem() const
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....
static GroupBoxCollapser * installIntoGroupBox(QGroupBox *groupBox, bool expanded=true)
Editor for the case where there is no single inclination angle.
Single-instrument-adapter to InstrumentsEditorController.
void notifyWavelengthDistributionChanged()
Update dependent data and emit a changed signal.
void notifyInclinationAxisChanged()
Update dependent data and emit a changed signal.
SpecularBeamEditor(QWidget *parent, SpecularBeamItem *item, InstrumentEditController *ec)
SpecularBeamInclinationItem * inclinationAngleItem() const override
configuration to control how the user can enter a mean value