Changeset 64265 in vbox
- Timestamp:
- Oct 13, 2016 4:49:48 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.cpp
r64264 r64265 50 50 UIHotKeyColumnIndex_Sequence, 51 51 UIHotKeyColumnIndex_Max 52 }; 53 54 55 /** Global settings / Input page / Shortcut table cell. */ 56 class UIShortcutCacheCell : public QITableViewCell 57 { 58 Q_OBJECT; 59 60 public: 61 62 /** Constructs table cell. 63 * @param pParent Brings the row this cell belongs too. 64 * @param strText Brings the text describing this cell. */ 65 UIShortcutCacheCell(QITableViewRow *pParent, const QString &strText) 66 : QITableViewCell(pParent) 67 , m_strText(strText) 68 {} 69 70 /** Returns the cell text. */ 71 virtual QString text() const /* override */ { return m_strText; } 72 73 private: 74 75 /** Holds the cell text. */ 76 QString m_strText; 52 77 }; 53 78 … … 76 101 , m_strCurrentSequence(strCurrentSequence) 77 102 , m_strDefaultSequence(strDefaultSequence) 78 {} 103 { 104 /* Create cells: */ 105 createCells(); 106 } 79 107 80 108 /** Constructs table row on the basis of @a other one. */ … … 85 113 , m_strCurrentSequence(other.currentSequence()) 86 114 , m_strDefaultSequence(other.defaultSequence()) 87 {} 115 { 116 /* Create cells: */ 117 createCells(); 118 } 119 120 /** Destructs table row. */ 121 ~UIShortcutCacheRow() 122 { 123 /* Destroy cells: */ 124 destroyCells(); 125 } 88 126 89 127 /** Copies a table row from @a other one. */ … … 96 134 m_strCurrentSequence = other.currentSequence(); 97 135 m_strDefaultSequence = other.defaultSequence(); 136 137 /* Recreate cells: */ 138 destroyCells(); 139 createCells(); 98 140 99 141 /* Return this: */ … … 125 167 virtual int childCount() const /* override */ 126 168 { 127 return 0;169 return UIHotKeyColumnIndex_Max; 128 170 } 129 171 … … 131 173 virtual QITableViewCell *childItem(int iIndex) const /* override */ 132 174 { 133 Q_UNUSED(iIndex); 175 switch (iIndex) 176 { 177 case UIHotKeyColumnIndex_Description: return m_cells.first; 178 case UIHotKeyColumnIndex_Sequence: return m_cells.second; 179 default: break; 180 } 134 181 return 0; 135 182 } 136 183 137 184 private: 185 186 /** Creates cells. */ 187 void createCells() 188 { 189 /* Create cells on the basis of description and current sequence: */ 190 m_cells = qMakePair(new UIShortcutCacheCell(this, m_strDescription), 191 new UIShortcutCacheCell(this, m_strCurrentSequence)); 192 } 193 194 /** Destroys cells. */ 195 void destroyCells() 196 { 197 /* Destroy cells: */ 198 delete m_cells.first; 199 delete m_cells.second; 200 m_cells.first = 0; 201 m_cells.second = 0; 202 } 138 203 139 204 /** Holds the key. */ … … 145 210 /** Holds the default sequence. */ 146 211 QString m_strDefaultSequence; 212 213 /** Holds the cell instances. */ 214 QPair<UIShortcutCacheCell*, UIShortcutCacheCell*> m_cells; 147 215 }; 148 216
Note:
See TracChangeset
for help on using the changeset viewer.