##// 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
@@ -59,6 +59,8 public:
59 59 */
60 60 QVariant data(const QString &key) const noexcept;
61 61
62 bool isRoot() const noexcept;
63
62 64 QString name() const noexcept;
63 65
64 66 /**
@@ -70,6 +70,11 QVariant DataSourceItem::data(const QString &key) const noexcept
70 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 78 QString DataSourceItem::name() const noexcept
74 79 {
75 80 return data(NAME_DATA_KEY).toString();
@@ -3,6 +3,7
3 3 <file>icones/dataSourceComponent.png</file>
4 4 <file>icones/dataSourceNode.png</file>
5 5 <file>icones/dataSourceProduct.png</file>
6 <file>icones/dataSourceRoot.png</file>
6 7 <file>icones/delete.png</file>
7 8 <file>icones/openInspector.png</file>
8 9 <file>icones/next.png</file>
@@ -16,8 +16,10 QIcon itemIcon(const DataSourceItem *dataSource)
16 16 if (dataSource) {
17 17 auto dataSourceType = dataSource->type();
18 18 switch (dataSourceType) {
19 case DataSourceItemType::NODE:
20 return QIcon{":/icones/dataSourceNode.png"};
19 case DataSourceItemType::NODE: {
20 return dataSource->isRoot() ? QIcon{":/icones/dataSourceRoot.png"}
21 : QIcon{":/icones/dataSourceNode.png"};
22 }
21 23 case DataSourceItemType::PRODUCT:
22 24 return QIcon{":/icones/dataSourceProduct.png"};
23 25 case DataSourceItemType::COMPONENT:
@@ -31,7 +33,7 QIcon itemIcon(const DataSourceItem *dataSource)
31 33 << QObject::tr("Can't set data source icon : unknown data source type");
32 34 }
33 35 else {
34 qCWarning(LOG_DataSourceTreeWidgetItem())
36 qCCritical(LOG_DataSourceTreeWidgetItem())
35 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