##// END OF EJS Templates
Changes data source item icons (2)...
Alexandre Leroux -
r345:7128846c289b
parent child
Show More
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
@@ -59,6 +59,8 public:
59 */
59 */
60 QVariant data(const QString &key) const noexcept;
60 QVariant data(const QString &key) const noexcept;
61
61
62 bool isRoot() const noexcept;
63
62 QString name() const noexcept;
64 QString name() const noexcept;
63
65
64 /**
66 /**
@@ -70,6 +70,11 QVariant DataSourceItem::data(const QString &key) const noexcept
70 return impl->m_Data.value(key);
70 return impl->m_Data.value(key);
71 }
71 }
72
72
73 bool DataSourceItem::isRoot() const noexcept
74 {
75 return impl->m_Parent == nullptr;
76 }
77
73 QString DataSourceItem::name() const noexcept
78 QString DataSourceItem::name() const noexcept
74 {
79 {
75 return data(NAME_DATA_KEY).toString();
80 return data(NAME_DATA_KEY).toString();
@@ -3,6 +3,7
3 <file>icones/dataSourceComponent.png</file>
3 <file>icones/dataSourceComponent.png</file>
4 <file>icones/dataSourceNode.png</file>
4 <file>icones/dataSourceNode.png</file>
5 <file>icones/dataSourceProduct.png</file>
5 <file>icones/dataSourceProduct.png</file>
6 <file>icones/dataSourceRoot.png</file>
6 <file>icones/delete.png</file>
7 <file>icones/delete.png</file>
7 <file>icones/openInspector.png</file>
8 <file>icones/openInspector.png</file>
8 <file>icones/next.png</file>
9 <file>icones/next.png</file>
@@ -16,8 +16,10 QIcon itemIcon(const DataSourceItem *dataSource)
16 if (dataSource) {
16 if (dataSource) {
17 auto dataSourceType = dataSource->type();
17 auto dataSourceType = dataSource->type();
18 switch (dataSourceType) {
18 switch (dataSourceType) {
19 case DataSourceItemType::NODE:
19 case DataSourceItemType::NODE: {
20 return QIcon{":/icones/dataSourceNode.png"};
20 return dataSource->isRoot() ? QIcon{":/icones/dataSourceRoot.png"}
21 : QIcon{":/icones/dataSourceNode.png"};
22 }
21 case DataSourceItemType::PRODUCT:
23 case DataSourceItemType::PRODUCT:
22 return QIcon{":/icones/dataSourceProduct.png"};
24 return QIcon{":/icones/dataSourceProduct.png"};
23 case DataSourceItemType::COMPONENT:
25 case DataSourceItemType::COMPONENT:
@@ -31,7 +33,7 QIcon itemIcon(const DataSourceItem *dataSource)
31 << QObject::tr("Can't set data source icon : unknown data source type");
33 << QObject::tr("Can't set data source icon : unknown data source type");
32 }
34 }
33 else {
35 else {
34 qCWarning(LOG_DataSourceTreeWidgetItem())
36 qCCritical(LOG_DataSourceTreeWidgetItem())
35 << QObject::tr("Can't set data source icon : the data source is null");
37 << QObject::tr("Can't set data source icon : the data source is null");
36 }
38 }
37
39
General Comments 0
You need to be logged in to leave comments. Login now