diff --git a/GUI/Model/Descriptor/SelectionProperty.h b/GUI/Model/Descriptor/SelectionProperty.h index b2f62b46d7cce009c039e0fd6d04ce1b08684fbe..de13213fced18fdc34241a54efb22de421d050e0 100644 --- a/GUI/Model/Descriptor/SelectionProperty.h +++ b/GUI/Model/Descriptor/SelectionProperty.h @@ -47,11 +47,10 @@ public: //! The current selection will be initialized with the first type in the catalog types. The //! optional arguments are the arguments which may be necessary for the creation method in the //! catalog. - template <typename... ArgsForCreation> - void initWithArgs(const QString& label, const QString& tooltip, - typename Catalog::Type currentType, ArgsForCreation... argsForCreation) + template <typename... Args> void initWithArgs(const QString& label, const QString& tooltip, + typename Catalog::Type currentType, Args... args) { - initFieldsAndSetter(label, tooltip, argsForCreation...); + initFieldsAndSetter(label, tooltip, args...); int index = Catalog::types().indexOf(currentType); setCurrentIndex(index); } @@ -87,14 +86,10 @@ public: CatalogedType* certainItem() const { return m_p.get(); } //! Directly set the new item. - void setCertainItem(CatalogedType* t) - { - m_p.reset(t); - } + void setCertainItem(CatalogedType* t) { m_p.reset(t); } //! Directly set the new item. - template <typename S> - S* setCertainItem() + template <typename S> S* setCertainItem() { auto* s = new S(); if (s != nullptr && m_initializer) @@ -119,15 +114,14 @@ public: //! Deserializes the catalog index of the currently selected type, creates a new //! object of this type and calls main deserialization method of the selected class. - template <typename... ArgsForCreation> - void readFrom(QXmlStreamReader* r, ArgsForCreation... argsForCreation) + template <typename... Args> void readFrom(QXmlStreamReader* r, Args... args) { const uint sel_ver = XML::readUIntAttribute(r, XML::Attrib::selection_version); Q_UNUSED(sel_ver) const uint typeIndex = XML::readUIntAttribute(r, XML::Attrib::type); const auto type = static_cast<typename Catalog::Type>(typeIndex); - auto* p = Catalog::create(type, argsForCreation...); + auto* p = Catalog::create(type, args...); if (p) { if (m_initializer) m_initializer(p, m_p.get()); @@ -144,9 +138,8 @@ public: int currentIndex() const { return m_types.indexOf(Catalog::type(m_p.get())); } private: - template <typename... ArgsForCreation> - void initFieldsAndSetter(const QString& label, const QString& tooltip, - ArgsForCreation... argsForCreation) + template <typename... Args> + void initFieldsAndSetter(const QString& label, const QString& tooltip, Args... args) { m_label = label; m_tooltip = tooltip; @@ -154,8 +147,8 @@ private: for (const auto type : m_types) m_options << Catalog::uiInfo(type).menuEntry; - currentIndexSetter = [this, argsForCreation...](int current) { - auto* p = Catalog::create(m_types[current], argsForCreation...); + currentIndexSetter = [this, args...](int current) { + auto* p = Catalog::create(m_types[current], args...); if (m_initializer) m_initializer(p, m_p.get()); m_p.reset(p);