From b36ed1fb767a665cd852bc602ee413bb2e8a29b9 Mon Sep 17 00:00:00 2001
From: Joachim Wuttke <j.wuttke@fz-juelich.de>
Date: Fri, 26 Jul 2024 14:41:51 +0200
Subject: [PATCH] rm last uses of PolyItem

---
 GUI/Model/Sim/InstrumentXML.cpp   |  1 -
 GUI/View/Numeric/ComboUtil.h      | 23 -----------------------
 GUI/View/Sample/HeinzFormLayout.h |  6 ------
 GUI/View/Sample/ISelectionForm.h  | 23 -----------------------
 GUI/View/Sample/PolyForm.h        |  7 -------
 5 files changed, 60 deletions(-)

diff --git a/GUI/Model/Sim/InstrumentXML.cpp b/GUI/Model/Sim/InstrumentXML.cpp
index 11a2b8052c7..3feb2ffd691 100644
--- a/GUI/Model/Sim/InstrumentXML.cpp
+++ b/GUI/Model/Sim/InstrumentXML.cpp
@@ -14,7 +14,6 @@
 
 #include "GUI/Model/Sim/InstrumentXML.h"
 #include "Base/Util/Assert.h"
-#include "GUI/Model/Descriptor/PolyItem.h"
 #include "GUI/Model/Sim/InstrumentCatalog.h"
 #include "GUI/Model/Sim/InstrumentItems.h"
 #include "GUI/Model/Util/UtilXML.h"
diff --git a/GUI/View/Numeric/ComboUtil.h b/GUI/View/Numeric/ComboUtil.h
index 23d4a580949..c744b76400e 100644
--- a/GUI/View/Numeric/ComboUtil.h
+++ b/GUI/View/Numeric/ComboUtil.h
@@ -15,7 +15,6 @@
 #ifndef BORNAGAIN_GUI_VIEW_NUMERIC_COMBOUTIL_H
 #define BORNAGAIN_GUI_VIEW_NUMERIC_COMBOUTIL_H
 
-#include "GUI/Model/Descriptor/PolyItem.h"
 #include "GUI/Model/Descriptor/PolyPtr.h"
 #include "GUI/View/Base/CustomEventFilters.h"
 #include <QComboBox>
@@ -47,28 +46,6 @@ QComboBox* createComboBox(std::function<ComboProperty()> comboFunction,
 //!
 //! Changes in the combobox will be notified to the PolyItem already. The additional (and
 //! optional) slot can be used to be notified about an already executed change.
-template <typename C>
-QComboBox* createComboBoxFromPolyitem(PolyItem<C>& d, std::function<void(int)> slot,
-                                      bool inScrollArea)
-{
-    auto* combo = new QComboBox;
-    combo->addItems(d.menuEntries());
-    combo->setMaxCount(d.menuEntries().size());
-    combo->setToolTip(d.piTooltip());
-    combo->setCurrentIndex(d.currentIndex());
-
-    if (inScrollArea)
-        WheelEventEater::install(combo);
-
-    QObject::connect(combo, &QComboBox::currentIndexChanged, [&d, slot](int index) {
-        d.setCurrentIndex(index);
-        if (slot)
-            slot(index);
-    });
-
-    return combo;
-}
-
 template <typename B, typename C>
 QComboBox* createComboBoxFromPolyPtr(PolyPtr<B, C>& d, std::function<void(int)> slot,
                                      bool inScrollArea)
diff --git a/GUI/View/Sample/HeinzFormLayout.h b/GUI/View/Sample/HeinzFormLayout.h
index c51c834d0db..477b208c184 100644
--- a/GUI/View/Sample/HeinzFormLayout.h
+++ b/GUI/View/Sample/HeinzFormLayout.h
@@ -15,7 +15,6 @@
 #ifndef BORNAGAIN_GUI_VIEW_SAMPLE_HEINZFORMLAYOUT_H
 #define BORNAGAIN_GUI_VIEW_SAMPLE_HEINZFORMLAYOUT_H
 
-#include "GUI/Model/Descriptor/PolyItem.h"
 #include "GUI/View/Sample/PolyForm.h"
 #include <QFormLayout>
 
@@ -56,11 +55,6 @@ public:
     //! sufficient. It has to be done "manually".
     //! For more details, see PolyForm.
     //! Returns the newly added row.
-    template <typename C> void addSelection(PolyItem<C>& d)
-    {
-        addBoldRow(d.piLabel(), new PolyForm(QFormLayout::parentWidget(), d, m_ec));
-    }
-
     template <typename B, typename C> void addSelection(PolyPtr<B, C>& d)
     {
         addBoldRow(d.piLabel(), new PolyForm(QFormLayout::parentWidget(), d, m_ec));
diff --git a/GUI/View/Sample/ISelectionForm.h b/GUI/View/Sample/ISelectionForm.h
index 10d923ea758..b70040e4630 100644
--- a/GUI/View/Sample/ISelectionForm.h
+++ b/GUI/View/Sample/ISelectionForm.h
@@ -15,7 +15,6 @@
 #ifndef BORNAGAIN_GUI_VIEW_SAMPLE_ISELECTIONFORM_H
 #define BORNAGAIN_GUI_VIEW_SAMPLE_ISELECTIONFORM_H
 
-#include "GUI/Model/Descriptor/PolyItem.h"
 #include "GUI/Model/Descriptor/PolyPtr.h"
 #include "GUI/View/Base/CustomEventFilters.h"
 #include "GUI/View/Sample/SampleEditorController.h"
@@ -34,28 +33,6 @@ public:
 protected:
     ISelectionForm(QWidget* parent, SampleEditorController* ec);
 
-    template <typename T> void initUI(PolyItem<T>& d)
-    {
-        m_grid_layout = new QGridLayout(this);
-        m_grid_layout->setContentsMargins(0, 0, 0, 0);
-        m_grid_layout->setSpacing(6);
-
-        m_combo = new QComboBox;
-        WheelEventEater::install(m_combo);
-        m_combo->addItems(d.menuEntries());
-        m_combo->setCurrentIndex(d.currentIndex());
-        m_combo->setMaxVisibleItems(m_combo->count());
-
-        QObject::connect(m_combo, &QComboBox::currentIndexChanged, [this, &d](int current) {
-            clear();
-            d.setCurrentIndex(current);
-            createContent();
-            emit m_ec->modified();
-        });
-
-        m_grid_layout->addWidget(m_combo, 1, 0);
-        createContent();
-    }
     void initUI(PolyBase& d)
     {
         m_grid_layout = new QGridLayout(this);
diff --git a/GUI/View/Sample/PolyForm.h b/GUI/View/Sample/PolyForm.h
index 30e3b6cd7e8..949d271b861 100644
--- a/GUI/View/Sample/PolyForm.h
+++ b/GUI/View/Sample/PolyForm.h
@@ -41,13 +41,6 @@
 //! sub-selections or different value types), this class is not sufficient.
 class PolyForm : public ISelectionForm {
 public:
-    template <typename C>
-    PolyForm(QWidget* parent, PolyItem<C>& d, SampleEditorController* ec)
-        : ISelectionForm(parent, ec)
-    {
-        currentValues = [&d] { return doublePropertiesOfItem(d.certainItem()); };
-        initUI(d);
-    }
     template <typename B, typename C>
     PolyForm(QWidget* parent, PolyPtr<B, C>& d, SampleEditorController* ec)
         : ISelectionForm(parent, ec)
-- 
GitLab