Changeset 105540 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jul 30, 2024 11:41:25 AM (6 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QITreeView.cpp
r105517 r105540 157 157 158 158 /* Return the number of children: */ 159 return item()->parentTree()->model()->rowCount(itemIndex); ;159 return item()->parentTree()->model()->rowCount(itemIndex); 160 160 } 161 161 162 162 QAccessibleInterface *QIAccessibilityInterfaceForQITreeViewItem::child(int iIndex) const /* override */ 163 163 { 164 /* Sanity check: */ 165 AssertPtrReturn(item(), 0); 166 AssertPtrReturn(item()->parentTree(), 0); 167 AssertPtrReturn(item()->parentTree()->model(), 0); 164 /* Make sure item still alive: */ 165 QITreeViewItem *pThisItem = item(); 166 AssertPtrReturn(pThisItem, 0); 167 /* Make sure tree still alive: */ 168 QITreeView *pTree = pThisItem->parentTree(); 169 AssertPtrReturn(pTree, 0); 170 /* Make sure model still alive: */ 171 QAbstractItemModel *pModel = pTree->model(); 172 AssertPtrReturn(pModel, 0); 173 /* Make sure index is valid: */ 168 174 AssertReturn(iIndex >= 0 && iIndex < childCount(), 0); 169 175 170 /* Acquire itemmodel-index: */171 const QModelIndex itemIndex = item()->modelIndex();172 /* Acquire child model-index: */ 173 const QModelIndex childIndex = item()->parentTree()->model()->index(iIndex, 0, itemIndex);174 176 /* Acquire parent model-index: */ 177 const QModelIndex parentIndex = pThisItem->modelIndex(); 178 179 /* Acquire child-index: */ 180 const QModelIndex childIndex = pModel->index(iIndex, 0, parentIndex); 175 181 /* Check whether we have proxy model set or source one otherwise: */ 176 const QSortFilterProxyModel *pProxyModel = qobject_cast<const QSortFilterProxyModel*>( item()->parentTree()->model());177 /* Acquire source child model-index, which can be the same as child model-index: */182 const QSortFilterProxyModel *pProxyModel = qobject_cast<const QSortFilterProxyModel*>(pModel); 183 /* Acquire source-model child-index (can be the same as original if there is no proxy model): */ 178 184 const QModelIndex sourceChildIndex = pProxyModel ? pProxyModel->mapToSource(childIndex) : childIndex; 179 /* Acquire source child item: */ 185 186 /* Acquire child item: */ 180 187 QITreeViewItem *pItem = reinterpret_cast<QITreeViewItem*>(sourceChildIndex.internalPointer()); 181 /* Return the child with the passed iIndex: */188 /* Return child item's accessibility interface: */ 182 189 return QAccessible::queryAccessibleInterface(pItem); 183 190 } … … 281 288 QAccessibleInterface *QIAccessibilityInterfaceForQITreeView::child(int iIndex) const 282 289 { 283 /* Make sure t able still alive: */290 /* Make sure tree still alive: */ 284 291 QITreeView *pTree = tree(); 285 292 AssertPtrReturn(pTree, 0); … … 370 377 const QModelIndex rootIndex = parentTree()->rootIndex(); 371 378 /* Acquire source root model-index, which can be the same as root model-index: */ 372 const QModelIndex sourceRootModelIndex = pProxyModel ? pProxyModel->mapToSource(rootIndex) : rootIndex;379 const QModelIndex rootSourceModelIndex = pProxyModel ? pProxyModel->mapToSource(rootIndex) : rootIndex; 373 380 374 381 /* Check whether we have root model-index here: */ 375 if ( sourceRootModelIndex.internalPointer()376 && sourceRootModelIndex.internalPointer() == this)382 if ( rootSourceModelIndex.internalPointer() 383 && rootSourceModelIndex.internalPointer() == this) 377 384 return rootIndex; 378 385 … … 387 394 const QModelIndex childIndex = pModel->index(i, 0, parentIndex); 388 395 /* Acquire source child model-index, which can be the same as child model-index: */ 389 const QModelIndex sourceChildModelIndex = pProxyModel ? pProxyModel->mapToSource(childIndex) : childIndex;396 const QModelIndex childSourceModelIndex = pProxyModel ? pProxyModel->mapToSource(childIndex) : childIndex; 390 397 391 398 /* Check whether we have child model-index here: */ 392 if ( sourceChildModelIndex.internalPointer()393 && sourceChildModelIndex.internalPointer() == this)399 if ( childSourceModelIndex.internalPointer() 400 && childSourceModelIndex.internalPointer() == this) 394 401 { 395 402 iPositionInParent = i;
Note:
See TracChangeset
for help on using the changeset viewer.