Changeset 64479 in vbox
- Timestamp:
- Oct 28, 2016 4:01:01 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 111613
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/extensions
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QITableView.cpp
r64238 r64479 397 397 AssertPtrReturn(table(), QString()); 398 398 399 /* Return t ree whats-this: */399 /* Return table whats-this: */ 400 400 return table()->whatsThis(); 401 401 } -
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QITableView.h
r64228 r64479 102 102 virtual int childCount() const { return 0; } 103 103 /** Returns the child item with @a iIndex. */ 104 virtual QITableViewRow *childItem(int iIndex) const { Q_UNUSED(iIndex);return 0; }104 virtual QITableViewRow *childItem(int /* iIndex */) const { return 0; } 105 105 106 106 /** Makes sure current editor data committed. */ -
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QITreeView.cpp
r64478 r64479 231 231 AssertPtrReturn(tree(), 0); 232 232 /* Make sure index is valid: */ 233 AssertReturn(iIndex >= 0 && iIndex < childCount(), 0); 233 AssertReturn(iIndex >= 0, 0); 234 if (iIndex >= childCount()) 235 { 236 // WORKAROUND: 237 // Normally I would assert here, but Qt5 accessibility code has 238 // a hard-coded architecture for a tree-views which we do not like 239 // but have to live with and this architecture enumerates children 240 // of all levels as children of level 0, so Qt5 can try to address 241 // our interface with index which surely out of bounds by our laws. 242 // So let's assume that's exactly such case and try to enumerate 243 // visible children like they are a part of the list, not tree. 244 // printf("Invalid index: %d\n", iIndex); 245 246 // Take into account we also have header with 'column count' indexes, 247 // so we should start enumerating tree indexes since 'column count'. 248 const int iColumnCount = tree()->model()->columnCount(); 249 int iCurrentIndex = iColumnCount; 250 251 // Set iterator to root-index initially: 252 const QModelIndex root = tree()->rootIndex(); 253 QModelIndex index = root; 254 255 // But if root-index has child, go deeper: 256 if (index.child(0, 0).isValid()) 257 index = index.child(0, 0); 258 259 // Search for sibling with corresponding index: 260 while (index.isValid() && iCurrentIndex < iIndex) 261 { 262 ++iCurrentIndex; 263 if (iCurrentIndex % iColumnCount == 0) 264 index = tree()->indexBelow(index); 265 } 266 267 // Return what we found: 268 // if (index.isValid()) 269 // printf("Item found: [%s]\n", ((QITreeViewItem*)index.internalPointer())->text().toUtf8().constData()); 270 // else 271 // printf("Item not found\n"); 272 return index.isValid() ? QAccessible::queryAccessibleInterface((QITreeViewItem*)index.internalPointer()) : 0; 273 } 234 274 235 275 /* Return the child with the passed iIndex: */ -
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QITreeWidget.cpp
r64308 r64479 261 261 // WORKAROUND: 262 262 // Normally I would assert here, but Qt5 accessibility code has 263 // a hard-coded architecture for a tree- views which we do not like263 // a hard-coded architecture for a tree-widgets which we do not like 264 264 // but have to live with and this architecture enumerates children 265 265 // of all levels as children of level 0, so Qt5 can try to address … … 269 269 // printf("Invalid index: %d\n", iIndex); 270 270 271 // Take into account we also have header with 'column count' indexes, 272 // so we should start enumerating tree indexes since 'column count'. 273 const int iColumnCount = tree()->columnCount(); 274 int iCurrentIndex = iColumnCount; 275 271 276 // Do some sanity check as well, enough? 272 AssertReturn(iIndex >= tree()->columnCount(), 0); 273 274 // The enumeration step is column count: 275 int iCurrentIndex = tree()->columnCount(); 277 AssertReturn(iIndex >= iColumnCount, 0); 278 279 // Search for sibling with corresponding index: 276 280 QTreeWidgetItem *pItem = tree()->topLevelItem(0); 277 281 while (pItem && iCurrentIndex < iIndex) 278 282 { 279 283 ++iCurrentIndex; 280 if (iCurrentIndex % tree()->columnCount()== 0)284 if (iCurrentIndex % iColumnCount == 0) 281 285 pItem = tree()->itemBelow(pItem); 282 286 } … … 284 288 // Return what we found: 285 289 // if (pItem) 286 // printf("Item found: [%s]\n", pItem->defaultText().toUtf8().constData()); 290 // printf("Item found: [%s]\n", pItem->text(0).toUtf8().constData()); 291 // else 292 // printf("Item not found\n"); 287 293 return pItem ? QAccessible::queryAccessibleInterface(QITreeWidgetItem::toItem(pItem)) : 0; 288 294 } -
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QITreeWidget.h
r64302 r64479 59 59 /** Returns the parent tree-widget item. */ 60 60 QITreeWidgetItem *parentItem() const; 61 61 62 /** Returns the child tree-widget item with @a iIndex. */ 62 63 QITreeWidgetItem *childItem(int iIndex) const;
Note:
See TracChangeset
for help on using the changeset viewer.