Changeset 65334 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jan 16, 2017 2:00:41 PM (8 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime/information
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationModel.cpp
r65333 r65334 49 49 UIInformationModel::~UIInformationModel() 50 50 { 51 /* Destroy all data-items: */ 52 qDeleteAll(m_list); 53 m_list.clear(); 51 /* Cleanup: */ 52 cleanup(); 54 53 } 55 54 … … 68 67 /* Return the data for the corresponding role: */ 69 68 return pItem->data(index, role); 70 }71 72 void UIInformationModel::prepare()73 {74 /* Prepare role-names for model: */75 QHash<int, QByteArray> roleNames;76 roleNames[Qt::DisplayRole] = "";77 roleNames[Qt::DecorationRole] = "";78 roleNames[Qt::UserRole + 1] = "";79 roleNames[Qt::UserRole + 2] = "";80 # if QT_VERSION < 0x05000081 setRoleNames(roleNames);82 # endif /* QT_VERSION < 0x050000 */83 84 /* Register meta-type: */85 qRegisterMetaType<InformationElementType>();86 }87 88 QHash<int, QByteArray> UIInformationModel::roleNames() const89 {90 /* Add supported roles and return: */91 QHash<int, QByteArray> roleNames;92 roleNames[Qt::DisplayRole] = "";93 roleNames[Qt::DecorationRole] = "";94 roleNames[Qt::UserRole + 1] = "";95 roleNames[Qt::UserRole + 2] = "";96 return roleNames;97 69 } 98 70 … … 120 92 } 121 93 94 void UIInformationModel::prepare() 95 { 96 /* Prepare role-names for model: */ 97 QHash<int, QByteArray> roleNames; 98 roleNames[Qt::DisplayRole] = ""; 99 roleNames[Qt::DecorationRole] = ""; 100 roleNames[Qt::UserRole + 1] = ""; 101 roleNames[Qt::UserRole + 2] = ""; 102 # if QT_VERSION < 0x050000 103 setRoleNames(roleNames); 104 # endif /* QT_VERSION < 0x050000 */ 105 106 /* Register meta-type: */ 107 qRegisterMetaType<InformationElementType>(); 108 } 109 110 void UIInformationModel::cleanup() 111 { 112 /* Destroy all data-items: */ 113 qDeleteAll(m_list); 114 m_list.clear(); 115 } 116 117 QHash<int, QByteArray> UIInformationModel::roleNames() const 118 { 119 /* Add supported roles and return: */ 120 QHash<int, QByteArray> roleNames; 121 roleNames[Qt::DisplayRole] = ""; 122 roleNames[Qt::DecorationRole] = ""; 123 roleNames[Qt::UserRole + 1] = ""; 124 roleNames[Qt::UserRole + 2] = ""; 125 return roleNames; 126 } 127 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationModel.h
r65333 r65334 82 82 /** Prepares all. */ 83 83 void prepare(); 84 /** Cleanups all. */ 85 void cleanup(); 84 86 85 87 /** Returns the list of role-names supported by model. */
Note:
See TracChangeset
for help on using the changeset viewer.