Changeset 79024 in vbox
- Timestamp:
- Jun 6, 2019 1:53:50 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 131176
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIFormEditorWidget.cpp
r79008 r79024 35 35 #include "QIWithRetranslateUI.h" 36 36 #include "UIFormEditorWidget.h" 37 #include "UIIconPool.h" 37 38 #include "UIMessageCenter.h" 38 39 … … 441 442 private: 442 443 444 /** Prepares all. */ 445 void prepare(); 446 443 447 /** Return the parent table-view reference. */ 444 448 QITableView *parentTable() const; … … 447 451 void updateGeneration(); 448 452 453 /** Returns icon hint for specified @a strItemName. */ 454 QIcon iconHint(const QString &strItemName) const; 455 449 456 /** Holds the Form Editor row list. */ 450 457 QList<UIFormEditorRow*> m_dataList; 458 459 /** Holds the hardcoded icon name map. */ 460 QMap<QString, QIcon> m_icons; 451 461 }; 452 462 … … 935 945 : QAbstractTableModel(pParent) 936 946 { 947 prepare(); 937 948 } 938 949 … … 1115 1126 switch (iRole) 1116 1127 { 1128 /* Decoration role: */ 1129 case Qt::DecorationRole: 1130 { 1131 /* Switch for different columns: */ 1132 switch (index.column()) 1133 { 1134 case UIFormEditorDataType_Name: return iconHint(m_dataList[index.row()]->nameToString()); 1135 default: return QVariant(); 1136 } 1137 } 1117 1138 /* Checkstate role: */ 1118 1139 case Qt::CheckStateRole: … … 1242 1263 } 1243 1264 1265 void UIFormEditorModel::prepare() 1266 { 1267 /* Prepare hardcoded icons map: */ 1268 m_icons["Name"] = UIIconPool::iconSet(":/name_16px.png"); 1269 m_icons["OS"] = UIIconPool::iconSet(":/os_type_16px.png"); 1270 m_icons["CPU"] = UIIconPool::iconSet(":/cpu_16px.png"); 1271 m_icons["Memory"] = UIIconPool::iconSet(":/ram_16px.png"); 1272 m_icons["Description"] = UIIconPool::iconSet(":/description_16px.png"); 1273 } 1274 1244 1275 QITableView *UIFormEditorModel::parentTable() const 1245 1276 { … … 1259 1290 } 1260 1291 } 1292 } 1293 1294 QIcon UIFormEditorModel::iconHint(const QString &strItemName) const 1295 { 1296 return m_icons.value(strItemName, UIIconPool::iconSet(":/session_info_16px.png")); 1261 1297 } 1262 1298
Note:
See TracChangeset
for help on using the changeset viewer.