##// END OF EJS Templates
(Minor) Uses QVariantHash alias in DataSourceItem
Alexandre Leroux -
r407:bd9c01bf5b9f
parent child
Show More
@@ -25,7 +25,7 public:
25 25 static const QString NAME_DATA_KEY;
26 26
27 27 explicit DataSourceItem(DataSourceItemType type, const QString &name);
28 explicit DataSourceItem(DataSourceItemType type, QHash<QString, QVariant> data = {});
28 explicit DataSourceItem(DataSourceItemType type, QVariantHash data = {});
29 29
30 30 /// @return the actions of the item as a vector
31 31 QVector<DataSourceItemAction *> actions() const noexcept;
@@ -60,7 +60,7 public:
60 60 QVariant data(const QString &key) const noexcept;
61 61
62 62 /// Gets all data
63 const QHash<QString, QVariant> &data() const noexcept;
63 QVariantHash data() const noexcept;
64 64
65 65 bool isRoot() const noexcept;
66 66
@@ -6,7 +6,7
6 6 const QString DataSourceItem::NAME_DATA_KEY = QStringLiteral("name");
7 7
8 8 struct DataSourceItem::DataSourceItemPrivate {
9 explicit DataSourceItemPrivate(DataSourceItemType type, QHash<QString, QVariant> data)
9 explicit DataSourceItemPrivate(DataSourceItemType type, QVariantHash data)
10 10 : m_Parent{nullptr}, m_Children{}, m_Type{type}, m_Data{std::move(data)}, m_Actions{}
11 11 {
12 12 }
@@ -14,16 +14,16 struct DataSourceItem::DataSourceItemPrivate {
14 14 DataSourceItem *m_Parent;
15 15 std::vector<std::unique_ptr<DataSourceItem> > m_Children;
16 16 DataSourceItemType m_Type;
17 QHash<QString, QVariant> m_Data;
17 QVariantHash m_Data;
18 18 std::vector<std::unique_ptr<DataSourceItemAction> > m_Actions;
19 19 };
20 20
21 21 DataSourceItem::DataSourceItem(DataSourceItemType type, const QString &name)
22 : DataSourceItem{type, QHash<QString, QVariant>{{NAME_DATA_KEY, name}}}
22 : DataSourceItem{type, QVariantHash{{NAME_DATA_KEY, name}}}
23 23 {
24 24 }
25 25
26 DataSourceItem::DataSourceItem(DataSourceItemType type, QHash<QString, QVariant> data)
26 DataSourceItem::DataSourceItem(DataSourceItemType type, QVariantHash data)
27 27 : impl{spimpl::make_unique_impl<DataSourceItemPrivate>(type, std::move(data))}
28 28 {
29 29 }
@@ -70,7 +70,7 QVariant DataSourceItem::data(const QString &key) const noexcept
70 70 return impl->m_Data.value(key);
71 71 }
72 72
73 const QHash<QString, QVariant> &DataSourceItem::data() const noexcept
73 QVariantHash DataSourceItem::data() const noexcept
74 74 {
75 75 return impl->m_Data;
76 76 }
General Comments 0
You need to be logged in to leave comments. Login now