From 79b512d18f0dfa9a91e3849086d580bb43133659 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Fri, 27 Oct 2023 11:13:07 +0200
Subject: [PATCH] mv offset to x, y groups

---
 GUI/View/Instrument/DetectorEditor.cpp | 38 ++++++++++++++------------
 1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/GUI/View/Instrument/DetectorEditor.cpp b/GUI/View/Instrument/DetectorEditor.cpp
index d5490671cbd..3249bb6c810 100644
--- a/GUI/View/Instrument/DetectorEditor.cpp
+++ b/GUI/View/Instrument/DetectorEditor.cpp
@@ -98,51 +98,55 @@ DetectorEditor::DetectorEditor(QWidget* parent, GISASInstrumentItem* instrItem)
     //... x-axis controls
 
     auto* xAxisFormLayout = new QFormLayout;
-    auto* xAxisGroupBox = new GroupBox("X axis", xAxisFormLayout, this);
 
     auto* xAxisNbinsSpinBox = new SafeSpinBox;
-    xAxisNbinsSpinBox->setRange(1, 65536);
-    xAxisNbinsSpinBox->setValue(detectorItem->xSize());
-    xAxisFormLayout->addRow("# bins:", xAxisNbinsSpinBox);
-
-    auto* widthSpinBox = new DoubleSpinBox(detectorItem->width());
-    xAxisFormLayout->addRow("Width [mm]:", widthSpinBox);
-
     connect(xAxisNbinsSpinBox, qOverload<int>(&QSpinBox::valueChanged),
             [this, detectorItem](int newValue) {
                 detectorItem->setXSize(newValue);
                 emit dataChanged();
             });
+    xAxisNbinsSpinBox->setRange(1, 65536);
+    xAxisNbinsSpinBox->setValue(detectorItem->xSize());
+    xAxisFormLayout->addRow("# bins:", xAxisNbinsSpinBox);
+
+    auto* widthSpinBox = new DoubleSpinBox(detectorItem->width());
     connect(widthSpinBox, qOverload<double>(&DoubleSpinBox::baseValueChanged),
             [this, detectorItem](double newValue) {
                 detectorItem->setWidth(newValue);
                 emit dataChanged();
             });
+    xAxisFormLayout->addRow("Width (mm):", widthSpinBox);
+
+    ::createSpinBox(xAxisFormLayout, detectorItem->u0(), this);
+
+    auto* xAxisGroupBox = new GroupBox("X axis", xAxisFormLayout, this);
     grid->addWidget(xAxisGroupBox, 1, 0);
 
     //... y-axis controls
 
     auto* yAxisFormLayout = new QFormLayout;
-    auto* yAxisGroupBox = new GroupBox("Y axis", yAxisFormLayout, this);
 
     auto* yAxisNbinsSpinBox = new SafeSpinBox;
-    yAxisNbinsSpinBox->setRange(1, 65536);
-    yAxisNbinsSpinBox->setValue(detectorItem->ySize());
-    yAxisFormLayout->addRow("# bins:", yAxisNbinsSpinBox);
-
-    auto* heightSpinBox = new DoubleSpinBox(detectorItem->height());
-    yAxisFormLayout->addRow("Height [mm]:", heightSpinBox);
-
     connect(yAxisNbinsSpinBox, qOverload<int>(&QSpinBox::valueChanged),
             [this, detectorItem](int newValue) {
                 detectorItem->setYSize(newValue);
                 emit dataChanged();
             });
+    yAxisNbinsSpinBox->setRange(1, 65536);
+    yAxisNbinsSpinBox->setValue(detectorItem->ySize());
+    yAxisFormLayout->addRow("# bins:", yAxisNbinsSpinBox);
+
+    auto* heightSpinBox = new DoubleSpinBox(detectorItem->height());
     connect(heightSpinBox, qOverload<double>(&DoubleSpinBox::baseValueChanged),
             [this, detectorItem](double newValue) {
                 detectorItem->setHeight(newValue);
                 emit dataChanged();
             });
+    yAxisFormLayout->addRow("Height (mm):", heightSpinBox);
+
+    ::createSpinBox(yAxisFormLayout, detectorItem->v0(), this);
+
+    auto* yAxisGroupBox = new GroupBox("Y axis", yAxisFormLayout, this);
     grid->addWidget(yAxisGroupBox, 1, 1);
 
     //... resolution controls
@@ -211,8 +215,6 @@ DetectorEditor::DetectorEditor(QWidget* parent, GISASInstrumentItem* instrItem)
     const QString& descr = alignmentDescription.at(detectorItem->detectorAlignment());
 
     auto* layoutUVD = new QFormLayout;
-    createSpinBox(layoutUVD, detectorItem->u0(), this);
-    createSpinBox(layoutUVD, detectorItem->v0(), this);
     createSpinBox(layoutUVD, detectorItem->distance(), this);
     detposLayout->addRow(descr + ":", layoutUVD);
 
-- 
GitLab