VirtualBox

Changeset 105541 in vbox


Ignore:
Timestamp:
Jul 30, 2024 11:55:10 AM (4 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10681: QITreeView: Reimplement function returning item rectangle for accessibility interface; Include item children into cumulative item rectangle; This is the subsequent step, s.a. r164182 and r164210.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QITreeView.cpp

    r105540 r105541  
    363363QRect QITreeViewItem::rect() const
    364364{
    365     /* Redirect call to parent-tree: */
    366     return parentTree() ? parentTree()->visualRect(modelIndex()) : QRect();
     365    /* We can only ask the parent-tree for a rectangle: */
     366    if (parentTree())
     367    {
     368        /* Acquire parent-tree model: */
     369        const QAbstractItemModel *pModel = parentTree()->model();
     370        AssertPtrReturn(pModel, QRect());
     371
     372        /* Acquire zero-column rectangle: */
     373        QModelIndex itemIndex = modelIndex();
     374        QRect rect = parentTree()->visualRect(itemIndex);
     375        /* Enumerate all the remaining columns: */
     376        for (int i = 1; i < pModel->columnCount(); ++i)
     377        {
     378            /* Acquire enumerated column rectangle: */
     379            QModelIndex itemIndexI = pModel->index(itemIndex.row(), i, itemIndex.parent());
     380            QRegion cumulativeRegion(rect);
     381            cumulativeRegion += parentTree()->visualRect(itemIndexI);
     382            rect = cumulativeRegion.boundingRect();
     383        }
     384        /* Total rect finally: */
     385        return rect;
     386    }
     387    /* Empty rect by default: */
     388    return QRect();
    367389}
    368390
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette