From edcbb42f4bb608f68e56e6e4e1a385e189450c38 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Fri, 27 Oct 2023 10:20:58 +0200 Subject: [PATCH] fct -> local ns --- GUI/View/Device/DetectorAlignmentForm.cpp | 32 +++++++++++------------ GUI/View/Device/DetectorAlignmentForm.h | 3 --- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/GUI/View/Device/DetectorAlignmentForm.cpp b/GUI/View/Device/DetectorAlignmentForm.cpp index 1bbed1d0e35..189204a35fc 100644 --- a/GUI/View/Device/DetectorAlignmentForm.cpp +++ b/GUI/View/Device/DetectorAlignmentForm.cpp @@ -27,6 +27,19 @@ const std::map<FlatDetector::NominalNormal, QString> alignmentDescription = { {FlatDetector::T, "Intersection of direct beam and detector"}, {FlatDetector::R, "Intersection of reflected beam and detector"}}; +DoubleSpinBox* createSpinBox(QFormLayout* parentFormLayout, + DoubleProperty& d, DetectorAlignmentForm* parent) +{ + auto* sb = GUI::Util::createDoubleSpinBoxRow(parentFormLayout, d); + parent->connect(sb, &DoubleSpinBox::baseValueChanged, [parent, &d](double v) { + if (d.value() != v) { + d.setValue(v); + emit parent->dataChanged(); + } + }); + return sb; +} + } // namespace DetectorAlignmentForm::DetectorAlignmentForm(QWidget* parent, DetectorItem* item) @@ -54,19 +67,6 @@ DetectorAlignmentForm::DetectorAlignmentForm(QWidget* parent, DetectorItem* item createAligmentWidgets(); } -DoubleSpinBox* DetectorAlignmentForm::createSpinBox(QFormLayout* parentFormLayout, - DoubleProperty& d) -{ - auto* sb = GUI::Util::createDoubleSpinBoxRow(parentFormLayout, d); - connect(sb, &DoubleSpinBox::baseValueChanged, [this, &d](double v) { - if (d.value() != v) { - d.setValue(v); - emit dataChanged(); - } - }); - return sb; -} - void DetectorAlignmentForm::createAligmentWidgets() { GUI::Util::Layout::clearLayout(m_formLayout); @@ -74,8 +74,8 @@ void DetectorAlignmentForm::createAligmentWidgets() const QString& descr = alignmentDescription.at(m_item->detectorAlignment()); auto* layoutUVD = new QFormLayout; - createSpinBox(layoutUVD, m_item->u0()); - createSpinBox(layoutUVD, m_item->v0()); - createSpinBox(layoutUVD, m_item->distance()); + createSpinBox(layoutUVD, m_item->u0(), this); + createSpinBox(layoutUVD, m_item->v0(), this); + createSpinBox(layoutUVD, m_item->distance(), this); m_formLayout->addRow(descr + ":", layoutUVD); } diff --git a/GUI/View/Device/DetectorAlignmentForm.h b/GUI/View/Device/DetectorAlignmentForm.h index 25e2905b4f1..6a60ba479e6 100644 --- a/GUI/View/Device/DetectorAlignmentForm.h +++ b/GUI/View/Device/DetectorAlignmentForm.h @@ -17,12 +17,10 @@ #include <QWidget> -class DetectorAlignmentForm; class DetectorItem; class DoubleProperty; class DoubleSpinBox; class QFormLayout; -class VectorProperty; /// Widget for selecting the alignment of a detector (combo box) and input of the corresponding /// values @@ -37,7 +35,6 @@ signals: private: void createAligmentWidgets(); - DoubleSpinBox* createSpinBox(QFormLayout* parentFormLayout, DoubleProperty& d); DetectorItem* m_item; QFormLayout* m_formLayout; -- GitLab