diff --git a/GUI/Model/Descriptor/SelectionProperty.h b/GUI/Model/Descriptor/SelectionProperty.h index f905edd24b3ce6bd4c195b6a042f2639d3e6e5eb..59db19da3a39e2381b4efd5ecd57ebaf28e97b31 100644 --- a/GUI/Model/Descriptor/SelectionProperty.h +++ b/GUI/Model/Descriptor/SelectionProperty.h @@ -46,19 +46,10 @@ public: //! pointer is handled in here. //! * label: a label of e.g. a spin box //! * tooltip: tooltip for e.g. a spin box -//! * persistent tag: a name to serialize this property. Do not change this string, since it is -//! serialized! -//! * A list of available options (e.g. the names of the distributions) -//! * A descriptor which provides some of the given information, as well as getters/setters. +//! * a list of available options (e.g. the names of the distributions) +//! * setters and getters //! -//! For the initialization of a SelectionProperty there are helper methods. They are not necessarily -//! to be called if they are not convenient. They are only there to help initialization e.g by using -//! a catalog. If no catalog exists for the given case, the initialization can be done by any means. -//! -//! This means especially that this class is **not** relying on the existence of a related catalog -//! class - a catalog helps but is not mandatory. -//! -//! \sa SelectionDescriptor +//! The initialization of a SelectionProperty is done using a catalog. //! template <typename Catalog> class SelectionProperty : public AbstractSelectionProperty{ @@ -75,9 +66,6 @@ public: { initFieldsAndSetter(label, tooltip, argsForCreation...); setCurrentIndex(0); - - initDescriptor(label, tooltip, argsForCreation...); - m_descriptor.setCurrentIndex(0); } //! Initialize by means of a catalog class and an initializer function. @@ -99,9 +87,6 @@ public: initFieldsAndSetter(label, tooltip); setCurrentIndex(0); - - initDescriptor(label, tooltip); - m_descriptor.setCurrentIndex(0); } //! Initialize by means of a catalog class, a subsection of allowed types and an initializer @@ -126,14 +111,8 @@ public: initFieldsAndSetter(label, tooltip); setCurrentIndex(0); - - initDescriptor(label, tooltip); - m_descriptor.setCurrentIndex(0); } - //! Cast to a descriptor working on this property. - operator SelectionDescriptor<CatalogedType*>() const { return m_descriptor; } - //! Direct access to the stored pointer CatalogedType* operator->() const { return m_p.get(); } @@ -178,9 +157,6 @@ public: void setCurrentIndex(int newIndex) override { currentIndexSetter(newIndex); } int currentIndex() const override { return m_types.indexOf(Catalog::type(m_p.get())); } - SelectionDescriptor<CatalogedType*> - m_descriptor; //!< descriptor, holding attributes like label, tooltip - private: template <typename... ArgsForCreation> void initFieldsAndSetter(const QString& label, const QString& tooltip, ArgsForCreation... argsForCreation) { @@ -198,29 +174,6 @@ private: }; } - template <typename... ArgsForCreation> - void initDescriptor(const QString& label, const QString& tooltip, - ArgsForCreation... argsForCreation) - - { - auto setCurrentIndex = [=](int current) { - auto* p = Catalog::create(m_types[current], argsForCreation...); - if (m_initializer) - m_initializer(p, m_p.get()); - m_p.reset(p); - }; - - m_descriptor.label = label; - m_descriptor.tooltip = tooltip; - for (const auto type : m_types) - m_descriptor.options << Catalog::uiInfo(type).menuEntry; - m_descriptor.currentIndexSetter = setCurrentIndex; - m_descriptor.currentIndexGetter = [=]() { - return m_types.indexOf(Catalog::type(m_p.get())); - }; - m_descriptor.currentItem = [=] { return m_p.get(); }; - } - private: std::unique_ptr<CatalogedType> m_p; //!< Current selection