VirtualBox

Changeset 64742 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Nov 24, 2016 4:10:53 PM (8 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6899: Accessibility support (step 136): Improving w/a for QITreeView by taking sort-filter-proxy models into account.

File:
1 edited

Legend:

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

    r64491 r64742  
    2424# include <QMouseEvent>
    2525# include <QPainter>
     26# include <QSortFilterProxyModel>
    2627
    2728/* GUI includes: */
     
    244245        // printf("Invalid index: %d\n", iIndex);
    245246
     247        // Make sure model is alive:
     248        AssertPtrReturn(tree()->model(), 0);
     249
    246250        // Take into account we also have header with 'column count' indexes,
    247251        // so we should start enumerating tree indexes since 'column count'.
     
    249253        int iCurrentIndex = iColumnCount;
    250254
     255        // Check whether we have proxy model set or usual one otherwise:
     256        QSortFilterProxyModel *pProxyModel = qobject_cast<QSortFilterProxyModel*>(tree()->model());
     257
    251258        // Set iterator to root-index initially:
    252         const QModelIndex root = tree()->rootIndex();
     259        const QModelIndex root = pProxyModel ? pProxyModel->mapToSource(tree()->rootIndex()) :
     260                                 tree()->rootIndex();
    253261        QModelIndex index = root;
    254262
     
    262270            ++iCurrentIndex;
    263271            if (iCurrentIndex % iColumnCount == 0)
    264                 index = tree()->indexBelow(index);
     272            {
     273                index = pProxyModel ? pProxyModel->mapToSource(tree()->indexBelow(pProxyModel->mapFromSource(index))) :
     274                                      tree()->indexBelow(index);
     275            }
    265276        }
    266277
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