##// END OF EJS Templates
Adds actions for items in the DataSourceWidget...
Alexandre Leroux -
r142:11579fae1cc2
parent child
Show More
@@ -24,6 +24,9 public:
24 24 virtual QVariant data(int column, int role) const override;
25 25 virtual void setData(int column, int role, const QVariant &value) override;
26 26
27 /// @return the actions associated to the item
28 QList<QAction *> actions() const noexcept;
29
27 30 private:
28 31 class DataSourceTreeWidgetItemPrivate;
29 32 spimpl::unique_impl_ptr<DataSourceTreeWidgetItemPrivate> impl;
@@ -3,6 +3,8
3 3
4 4 #include <SqpApplication.h>
5 5
6 #include <QAction>
7
6 8 Q_LOGGING_CATEGORY(LOG_DataSourceTreeWidgetItem, "DataSourceTreeWidgetItem")
7 9
8 10 namespace {
@@ -40,6 +42,9 struct DataSourceTreeWidgetItem::DataSourceTreeWidgetItemPrivate {
40 42
41 43 /// Model used to retrieve data source information
42 44 const DataSourceItem *m_Data;
45 /// Actions associated to the item. The parent of the item (QTreeWidget) takes the ownership of
46 /// the actions
47 QList<QAction *> m_Actions;
43 48 };
44 49
45 50 DataSourceTreeWidgetItem::DataSourceTreeWidgetItem(const DataSourceItem *data, int type)
@@ -54,6 +59,8 DataSourceTreeWidgetItem::DataSourceTreeWidgetItem(QTreeWidget *parent, const Da
54 59 {
55 60 // Sets the icon depending on the data source
56 61 setIcon(0, itemIcon(impl->m_Data));
62
63 /// @todo ALX : generate actions based on the DataSourceItem (model)
57 64 }
58 65
59 66 QVariant DataSourceTreeWidgetItem::data(int column, int role) const
@@ -73,3 +80,8 void DataSourceTreeWidgetItem::setData(int column, int role, const QVariant &val
73 80 QTreeWidgetItem::setData(column, role, value);
74 81 }
75 82 }
83
84 QList<QAction *> DataSourceTreeWidgetItem::actions() const noexcept
85 {
86 return impl->m_Actions;
87 }
General Comments 0
You need to be logged in to leave comments. Login now