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

SelectionProperty rename member -> m_item

parent 98fc42e8
No related branches found
No related tags found
1 merge request!2364rename SelectionProperty -> PolyItem
...@@ -80,21 +80,21 @@ public: ...@@ -80,21 +80,21 @@ public:
} }
//! Direct access to the stored pointer //! Direct access to the stored pointer
CatalogedType* operator->() const { return m_p.get(); } CatalogedType* operator->() const { return m_item.get(); }
//! Direct access to the stored pointer //! Direct access to the stored pointer
CatalogedType* certainItem() const { return m_p.get(); } CatalogedType* certainItem() const { return m_item.get(); }
//! Directly set the new item. //! Directly set the new item.
void setCertainItem(CatalogedType* t) { m_p.reset(t); } void setCertainItem(CatalogedType* t) { m_item.reset(t); }
//! Directly set the new item. //! Directly set the new item.
template <typename S> S* setCertainItem() template <typename S> S* setCertainItem()
{ {
auto* s = new S(); auto* s = new S();
if (s != nullptr && m_initializer) if (s != nullptr && m_initializer)
m_initializer(s, m_p.get()); m_initializer(s, m_item.get());
m_p.reset(s); m_item.reset(s);
return s; return s;
} }
...@@ -102,14 +102,14 @@ public: ...@@ -102,14 +102,14 @@ public:
//! main serialization method of the selected class. //! main serialization method of the selected class.
void writeTo(QXmlStreamWriter* w) const void writeTo(QXmlStreamWriter* w) const
{ {
const uint typeIndex = static_cast<uint>(Catalog::type(m_p.get())); const uint typeIndex = static_cast<uint>(Catalog::type(m_item.get()));
XML::writeAttribute(w, XML::Attrib::type, typeIndex); XML::writeAttribute(w, XML::Attrib::type, typeIndex);
// The next line allows to see the name of item type in XML. May be skipped while reading. // The next line allows to see the name of item type in XML. May be skipped while reading.
XML::writeAttribute(w, XML::Attrib::name, XML::writeAttribute(w, XML::Attrib::name,
Catalog::uiInfo(Catalog::type(m_p.get())).menuEntry); Catalog::uiInfo(Catalog::type(m_item.get())).menuEntry);
XML::writeAttribute(w, XML::Attrib::selection_version, uint(1)); XML::writeAttribute(w, XML::Attrib::selection_version, uint(1));
if (m_p) if (m_item)
m_p->writeTo(w); m_item->writeTo(w);
} }
//! Deserializes the catalog index of the currently selected type, creates a new //! Deserializes the catalog index of the currently selected type, creates a new
...@@ -124,10 +124,10 @@ public: ...@@ -124,10 +124,10 @@ public:
auto* p = Catalog::create(type, args...); auto* p = Catalog::create(type, args...);
if (p) { if (p) {
if (m_initializer) if (m_initializer)
m_initializer(p, m_p.get()); m_initializer(p, m_item.get());
p->readFrom(r); p->readFrom(r);
} }
m_p.reset(p); m_item.reset(p);
} }
QString label() const { return m_label; } QString label() const { return m_label; }
...@@ -135,7 +135,7 @@ public: ...@@ -135,7 +135,7 @@ public:
QStringList options() const { return m_options; } QStringList options() const { return m_options; }
void setCurrentIndex(int newIndex) { currentIndexSetter(newIndex); } void setCurrentIndex(int newIndex) { currentIndexSetter(newIndex); }
int currentIndex() const { return m_types.indexOf(Catalog::type(m_p.get())); } int currentIndex() const { return m_types.indexOf(Catalog::type(m_item.get())); }
private: private:
template <typename... Args> template <typename... Args>
...@@ -150,12 +150,12 @@ private: ...@@ -150,12 +150,12 @@ private:
currentIndexSetter = [this, args...](int current) { currentIndexSetter = [this, args...](int current) {
auto* p = Catalog::create(m_types[current], args...); auto* p = Catalog::create(m_types[current], args...);
if (m_initializer) if (m_initializer)
m_initializer(p, m_p.get()); m_initializer(p, m_item.get());
m_p.reset(p); m_item.reset(p);
}; };
} }
std::unique_ptr<CatalogedType> m_p; //!< Current selection std::unique_ptr<CatalogedType> m_item; //!< Current selection
QString m_label; //!< A label text (short, no trailing colon) QString m_label; //!< A label text (short, no trailing colon)
QString m_tooltip; //!< Tooltip text QString m_tooltip; //!< Tooltip text
......
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