Skip to content
Snippets Groups Projects
Commit b36ed1fb authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

rm last uses of PolyItem

parent a966715a
No related branches found
No related tags found
1 merge request!2696PolyItem -> PolyPtr, with BaseItem as separate template parameter
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "GUI/Model/Sim/InstrumentXML.h" #include "GUI/Model/Sim/InstrumentXML.h"
#include "Base/Util/Assert.h" #include "Base/Util/Assert.h"
#include "GUI/Model/Descriptor/PolyItem.h"
#include "GUI/Model/Sim/InstrumentCatalog.h" #include "GUI/Model/Sim/InstrumentCatalog.h"
#include "GUI/Model/Sim/InstrumentItems.h" #include "GUI/Model/Sim/InstrumentItems.h"
#include "GUI/Model/Util/UtilXML.h" #include "GUI/Model/Util/UtilXML.h"
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#ifndef BORNAGAIN_GUI_VIEW_NUMERIC_COMBOUTIL_H #ifndef BORNAGAIN_GUI_VIEW_NUMERIC_COMBOUTIL_H
#define 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/Model/Descriptor/PolyPtr.h"
#include "GUI/View/Base/CustomEventFilters.h" #include "GUI/View/Base/CustomEventFilters.h"
#include <QComboBox> #include <QComboBox>
...@@ -47,28 +46,6 @@ QComboBox* createComboBox(std::function<ComboProperty()> comboFunction, ...@@ -47,28 +46,6 @@ QComboBox* createComboBox(std::function<ComboProperty()> comboFunction,
//! //!
//! Changes in the combobox will be notified to the PolyItem already. The additional (and //! 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. //! 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> template <typename B, typename C>
QComboBox* createComboBoxFromPolyPtr(PolyPtr<B, C>& d, std::function<void(int)> slot, QComboBox* createComboBoxFromPolyPtr(PolyPtr<B, C>& d, std::function<void(int)> slot,
bool inScrollArea) bool inScrollArea)
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#ifndef BORNAGAIN_GUI_VIEW_SAMPLE_HEINZFORMLAYOUT_H #ifndef BORNAGAIN_GUI_VIEW_SAMPLE_HEINZFORMLAYOUT_H
#define 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 "GUI/View/Sample/PolyForm.h"
#include <QFormLayout> #include <QFormLayout>
...@@ -56,11 +55,6 @@ public: ...@@ -56,11 +55,6 @@ public:
//! sufficient. It has to be done "manually". //! sufficient. It has to be done "manually".
//! For more details, see PolyForm. //! For more details, see PolyForm.
//! Returns the newly added row. //! 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) template <typename B, typename C> void addSelection(PolyPtr<B, C>& d)
{ {
addBoldRow(d.piLabel(), new PolyForm(QFormLayout::parentWidget(), d, m_ec)); addBoldRow(d.piLabel(), new PolyForm(QFormLayout::parentWidget(), d, m_ec));
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#ifndef BORNAGAIN_GUI_VIEW_SAMPLE_ISELECTIONFORM_H #ifndef BORNAGAIN_GUI_VIEW_SAMPLE_ISELECTIONFORM_H
#define 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/Model/Descriptor/PolyPtr.h"
#include "GUI/View/Base/CustomEventFilters.h" #include "GUI/View/Base/CustomEventFilters.h"
#include "GUI/View/Sample/SampleEditorController.h" #include "GUI/View/Sample/SampleEditorController.h"
...@@ -34,28 +33,6 @@ public: ...@@ -34,28 +33,6 @@ public:
protected: protected:
ISelectionForm(QWidget* parent, SampleEditorController* ec); 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) void initUI(PolyBase& d)
{ {
m_grid_layout = new QGridLayout(this); m_grid_layout = new QGridLayout(this);
......
...@@ -41,13 +41,6 @@ ...@@ -41,13 +41,6 @@
//! sub-selections or different value types), this class is not sufficient. //! sub-selections or different value types), this class is not sufficient.
class PolyForm : public ISelectionForm { class PolyForm : public ISelectionForm {
public: 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> template <typename B, typename C>
PolyForm(QWidget* parent, PolyPtr<B, C>& d, SampleEditorController* ec) PolyForm(QWidget* parent, PolyPtr<B, C>& d, SampleEditorController* ec)
: ISelectionForm(parent, ec) : ISelectionForm(parent, ec)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment