From 24b4e7dcee6f08e299bc4387756ebc92334d7941 Mon Sep 17 00:00:00 2001
From: Mikhail Svechnikov <m.svechnikov@fz-juelich.de>
Date: Thu, 6 Jul 2023 13:09:05 +0200
Subject: [PATCH] upd gui forms

---
 .../Instrument/PolarizationAnalysisEditor.cpp | 56 ++++++++++++++-----
 1 file changed, 41 insertions(+), 15 deletions(-)

diff --git a/GUI/View/Instrument/PolarizationAnalysisEditor.cpp b/GUI/View/Instrument/PolarizationAnalysisEditor.cpp
index e8b56bca05b..61915105da3 100644
--- a/GUI/View/Instrument/PolarizationAnalysisEditor.cpp
+++ b/GUI/View/Instrument/PolarizationAnalysisEditor.cpp
@@ -27,25 +27,51 @@ PolarizationAnalysisEditor::PolarizationAnalysisEditor(QWidget* parent, Instrume
 
     auto* layout = new QVBoxLayout(this);
 
-    auto* checkbox = new QCheckBox(QString("Enable %1").arg(title()));
-    checkbox->setChecked(m_instrument->withPolarizerAnalyzer());
-    layout->addWidget(checkbox);
+    // polarizer
+    {
+        auto* polarizerCheckbox = new QCheckBox("Enable beam polarization");
+        polarizerCheckbox->setChecked(m_instrument->withPolarizer());
+        layout->addWidget(polarizerCheckbox);
 
-    auto* polarizerAnalyzerWidget = new QWidget(this);
-    auto* formlayout = new QFormLayout(polarizerAnalyzerWidget);
-    formlayout->setFieldGrowthPolicy(QFormLayout::FieldsStayAtSizeHint);
+        auto* polarizerWidget = new QWidget(this);
+        auto* polarizerLayout = new QFormLayout(polarizerWidget);
+        polarizerLayout->setFieldGrowthPolicy(QFormLayout::FieldsStayAtSizeHint);
 
-    addPolarizerRow(formlayout, m_instrument->polarizerBlochVector());
-    addPolarizerRow(formlayout, m_instrument->analyzerBlochVector());
+        addPolarizerRow(polarizerLayout, m_instrument->polarizerBlochVector());
 
-    layout->addWidget(polarizerAnalyzerWidget);
-    polarizerAnalyzerWidget->setVisible(m_instrument->withPolarizerAnalyzer());
+        layout->addWidget(polarizerWidget);
+        polarizerWidget->setVisible(m_instrument->withPolarizer());
 
-    connect(checkbox, &QCheckBox::toggled, [this, polarizerAnalyzerWidget](bool b) {
-        polarizerAnalyzerWidget->setVisible(b);
-        m_instrument->setWithPolarizerAnalyzer(b);
-        emit dataChanged();
-    });
+        connect(polarizerCheckbox, &QCheckBox::toggled, [this, polarizerWidget](bool b) {
+            polarizerWidget->setVisible(b);
+            m_instrument->setWithPolarizer(b);
+            emit dataChanged();
+        });
+    }
+
+    // analyzer
+    {
+        auto* analyzerCheckbox = new QCheckBox("Enable analyzer");
+        analyzerCheckbox->setChecked(m_instrument->withPolarizer());
+        layout->addWidget(analyzerCheckbox);
+
+        auto* analyzerWidget = new QWidget(this);
+        auto* analyzerLayout = new QFormLayout(analyzerWidget);
+        analyzerLayout->setFieldGrowthPolicy(QFormLayout::FieldsStayAtSizeHint);
+
+        addPolarizerRow(analyzerLayout, m_instrument->analyzerBlochVector());
+
+        layout->addWidget(analyzerWidget);
+        analyzerWidget->setVisible(m_instrument->withPolarizer());
+
+        connect(analyzerCheckbox, &QCheckBox::toggled, [this, analyzerWidget](bool b) {
+            analyzerWidget->setVisible(b);
+            m_instrument->setWithAnalyzer(b);
+            emit dataChanged();
+        });
+    }
+
+    // collapser
 
     auto* collapser = GroupBoxCollapser::installIntoGroupBox(this);
     collapser->setExpanded(instrument->isExpandPolarizerAlanyzer());
-- 
GitLab