20 #include <QFormLayout>
24 QString alignmentDescription(RectangularDetector::EDetectorArrangement a)
27 case RectangularDetector::GENERIC:
28 return "Intersection of normal and detector";
29 case RectangularDetector::PERPENDICULAR_TO_SAMPLE:
30 return "Intersection of sample x-axis and detector";
31 case RectangularDetector::PERPENDICULAR_TO_DIRECT_BEAM:
32 return "Intersection of direct beam and detector";
33 case RectangularDetector::PERPENDICULAR_TO_REFLECTED_BEAM:
34 return "Intersection of reflected beam and detector";
35 case RectangularDetector::PERPENDICULAR_TO_REFLECTED_BEAM_DPOS:
36 return "Intersection of direct beam and detector";
55 createAligmentWidgets();
90 auto* layout =
new QHBoxLayout;
94 layout->addWidget(
createSpinBox(parentLayout->parentWidget(), d));
101 layout->addItem(
new QSpacerItem(0, 0, QSizePolicy::Expanding));
103 parentLayout->addRow(d.
label +
":", layout);
112 auto* layout =
new QFormLayout;
113 layout->setFieldGrowthPolicy(QFormLayout::FieldsStayAtSizeHint);
114 layout->setContentsMargins(0, 0, 0, 0);
120 auto* layoutUV =
new QFormLayout;
123 layout->addRow(descr +
":", layoutUV);
125 auto* layoutUVD =
new QFormLayout;
129 layout->addRow(descr +
":", layoutUVD);
A widget for editing the alignment of a detector.
Defines class DoubleSpinBox.
Defines class RectangularDetectorItem.
RectangularDetectorItem * m_item
DetectorAlignmentEditor(QWidget *parent, RectangularDetectorItem *item)
DoubleSpinBox * createSpinBox(QFormLayout *parentFormLayout, const DoubleDescriptor &d)
void addVector(QFormLayout *parentLayout, const VectorDescriptor &d)
void createAligmentWidgets()
QFormLayout * m_formLayout
Describes properties of a double value which are necessary to allow GUI representation,...
function< double()> get
function to get the current value
SpinBox for DoubleDescriptors, supporting units.
void baseValueChanged(double newBaseValue)
Emitted whenever the value changes.
SelectionDescriptor< RectangularDetector::EDetectorArrangement > detectorAlignmentSelection() const
RectangularDetector::EDetectorArrangement detectorAlignment() const
Describes properties of a 3D vector, consisting of three double values.
QString label
A label text (short, no trailing colon)
QComboBox * createSelectionCombo(QWidget *parent, const SelectionDescriptor< T > d, std::function< void(int)> slot=nullptr)
Create a combo box with the information found in a selection descriptor.
QSpinBox * createSpinBox(QWidget *parent, const UIntDescriptor &d, std::function< void(uint)> slot=nullptr)
Create a spin box with the information found in a UIntDescriptor.
QString labelWithUnit(const QString &label, std::variant< QString, Unit > unit)
Create a label with an optional unit in brackets.