23 #include <QDoubleValidator>
24 #include <QFormLayout>
25 #include <QGridLayout>
29 : QGroupBox(
"Beam parameters", parent)
32 auto* vLayout =
new QVBoxLayout(
this);
33 vLayout->setContentsMargins(30, 8, 0, 0);
34 auto* form =
new QFormLayout();
35 form->setFieldGrowthPolicy(QFormLayout::FieldsStayAtSizeHint);
36 vLayout->addLayout(form);
37 auto* intensityEditor =
new QLineEdit(
this);
38 intensityEditor->setToolTip(
"Beam intensity in neutrons (or gammas per second.");
40 validator->setNotation(QDoubleValidator::ScientificNotation);
41 validator->setRange(0.0, 1e+32, 1000);
42 intensityEditor->setValidator(validator);
44 form->addRow(
"Intensity:", intensityEditor);
48 vLayout->addWidget(wavelengthEditor);
50 auto* inclinationEditor =
53 vLayout->addWidget(inclinationEditor);
55 auto* azimuthalEditor =
58 vLayout->addWidget(azimuthalEditor);
60 intensityEditor->setText(QString::number(item->intensity()));
72 connect(intensityEditor, &QLineEdit::textEdited, [=]() {
73 QString str = intensityEditor->text();
75 if (intensityEditor->validator()->validate(str, pos) == QValidator::Acceptable) {
76 item->setIntensity(intensityEditor->text().toDouble());
83 auto* editor = qobject_cast<QLineEdit*>(validator->parent());
84 editor->setText(QString::number(item->intensity(),
'g'));
Defines class BeamAngleItems.
Defines BeamItem hierarchy.
Defines class BeamWavelengthItem.
A widget for selecting a distribution and setting its parameters.
Defines class DoubleDescriptor.
Defines class FixupDoubleValidator.
Defines class GISASBeamEditor.
Defines class GroupBoxCollapser.
virtual BeamDistributionItem * inclinationAngleItem() const
BeamAzimuthalAngleItem * azimuthalAngleItem() const
BeamWavelengthItem * wavelengthItem() const
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....
GISASBeamEditor(QWidget *parent, BeamItem *item)
static GroupBoxCollapser * installIntoGroupBox(QGroupBox *groupBox, bool expanded=true)
configuration to control how the user can enter a mean value