##// END OF EJS Templates
Implements merge method (2)...
Alexandre Leroux -
r1073:243c12122366
parent child
Show More
@@ -29,6 +29,8 public:
29 29 explicit DataSourceItem(DataSourceItemType type, const QString &name);
30 30 explicit DataSourceItem(DataSourceItemType type, QVariantHash data = {});
31 31
32 std::unique_ptr<DataSourceItem> clone() const;
33
32 34 /// @return the actions of the item as a vector
33 35 QVector<DataSourceItemAction *> actions() const noexcept;
34 36
@@ -35,6 +35,8 public:
35 35 */
36 36 explicit DataSourceItemAction(const QString &name, ExecuteFunction fun);
37 37
38 std::unique_ptr<DataSourceItemAction> clone() const;
39
38 40 QString name() const noexcept;
39 41
40 42 /// Sets the data source item concerned by the action
@@ -29,6 +29,23 DataSourceItem::DataSourceItem(DataSourceItemType type, QVariantHash data)
29 29 {
30 30 }
31 31
32 std::unique_ptr<DataSourceItem> DataSourceItem::clone() const
33 {
34 auto result = std::make_unique<DataSourceItem>(impl->m_Type, impl->m_Data);
35
36 // Clones children
37 for (const auto &child : impl->m_Children) {
38 result->appendChild(std::move(child->clone()));
39 }
40
41 // Clones actions
42 for (const auto &action : impl->m_Actions) {
43 result->addAction(std::move(action->clone()));
44 }
45
46 return result;
47 }
48
32 49 QVector<DataSourceItemAction *> DataSourceItem::actions() const noexcept
33 50 {
34 51 auto result = QVector<DataSourceItemAction *>{};
@@ -22,6 +22,11 DataSourceItemAction::DataSourceItemAction(const QString &name, ExecuteFunction
22 22 {
23 23 }
24 24
25 std::unique_ptr<DataSourceItemAction> DataSourceItemAction::clone() const
26 {
27 return std::make_unique<DataSourceItemAction>(impl->m_Name, impl->m_Fun);
28 }
29
25 30 QString DataSourceItemAction::name() const noexcept
26 31 {
27 32 return impl->m_Name;
General Comments 0
You need to be logged in to leave comments. Login now