24 #include <QDoubleValidator>
25 #include <QFormLayout>
26 #include <QGridLayout>
30 : QGroupBox(
"Beam parameters", parent)
34 auto* vLayout =
new QVBoxLayout(
this);
35 vLayout->setContentsMargins(30, 8, 0, 0);
36 auto* form =
new QFormLayout();
37 form->setFieldGrowthPolicy(QFormLayout::FieldsStayAtSizeHint);
38 vLayout->addLayout(form);
39 auto* intensityEditor =
new QLineEdit(
this);
40 intensityEditor->setToolTip(
"Beam intensity in neutrons (or gammas per second.");
42 validator->setNotation(QDoubleValidator::ScientificNotation);
43 validator->setRange(0.0, 1e+32, 1000);
44 intensityEditor->setValidator(validator);
45 form->addRow(
"Intensity:", intensityEditor);
47 auto* wavelengthEditor =
50 vLayout->addWidget(wavelengthEditor);
52 auto* inclinationEditor =
new AxisPropertyEditor(
this,
"Inclination angle", &item->alphaAxis());
53 vLayout->addWidget(inclinationEditor);
55 auto* azimuthalEditor =
57 this, item->
beamItem()->azimuthalAngleItem());
58 vLayout->addWidget(azimuthalEditor);
60 intensityEditor->setText(QString::number(item->
beamItem()->intensity()));
72 connect(intensityEditor, &QLineEdit::textEdited, [=]() {
73 QString str = intensityEditor->text();
75 if (intensityEditor->validator()->validate(str, pos) == QValidator::Acceptable) {
76 item->beamItem()->setIntensity(intensityEditor->text().toDouble());
83 auto* editor = qobject_cast<QLineEdit*>(validator->parent());
84 editor->setText(QString::number(item->
beamItem()->intensity(),
'g'));
Defines class AxisPropertyEditor.
Defines class BeamAngleItems.
Defines class BeamWavelengthItem.
A widget for selecting a distribution and setting its parameters.
Defines class DoubleDescriptor.
Defines class FixupDoubleValidator.
Defines class GroupBoxCollapser.
Defines class InstrumentItem and all its children.
Defines class OffspecBeamEditor.
Use this to edit an AxisProperty.
DistributionSelector as above but contained in a GroupBox with a title and a button to open the distr...
void distributionChanged()
The FixupDoubleValidator class is a derivative of QDoubleValidator with non-empty "fixup" method....
static GroupBoxCollapser * installIntoGroupBox(QGroupBox *groupBox, bool expanded=true)
virtual BeamItem * beamItem() const
OffspecBeamEditor(QWidget *parent, OffspecInstrumentItem *item)
configuration to control how the user can enter a mean value