VirtualBox

Changeset 104513 in vbox


Ignore:
Timestamp:
May 3, 2024 4:09:10 PM (7 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10681: Accessibility fixes for QITreeView interface; Adjust rectangle to take children into account.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/extensions
Files:
2 edited

Legend:

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

    r103987 r104513  
    8787    /** Returns corresponding QITreeViewItem. */
    8888    QITreeViewItem *item() const { return qobject_cast<QITreeViewItem*>(object()); }
     89
     90    /** Returns item bounding rectangle including all the children. */
     91    QRect boundingRect() const;
    8992};
    9093
     
    199202
    200203    /* Get the local rect: */
    201     const QRect  itemRectInViewport = item()->rect();
     204    const QRect  itemRectInViewport = boundingRect();
    202205    const QSize  itemSize           = itemRectInViewport.size();
    203206    const QPoint itemPosInViewport  = itemRectInViewport.topLeft();
     
    235238    /* Empty state by default: */
    236239    return QAccessible::State();
     240}
     241
     242QRect QIAccessibilityInterfaceForQITreeViewItem::boundingRect() const
     243{
     244    /* Calculate cumulative region: */
     245    QRegion region;
     246    /* Append item rectangle itself: */
     247    region += item()->rect();
     248    /* Do the same for all the children: */
     249    for (int i = 0; i < childCount(); ++i)
     250    {
     251        QIAccessibilityInterfaceForQITreeViewItem *pChild =
     252            dynamic_cast<QIAccessibilityInterfaceForQITreeViewItem*>(child(i));
     253        AssertPtrReturn(pChild, QRect());
     254        region += pChild->boundingRect();
     255    }
     256    /* Return cumulative bounding rectangle: */
     257    return region.boundingRect();
    237258}
    238259
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QITreeView.h

    r103977 r104513  
    134134    virtual QITreeViewItem *childItem(int /* iIndex */) const { return 0; }
    135135
    136     /** Returns child rectangle. */
    137     QRect visualRect(const QModelIndex &index) const RT_OVERRIDE { return QTreeView::visualRect(index); }
    138 
    139136protected slots:
    140137
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