VirtualBox

Changeset 64238 in vbox


Ignore:
Timestamp:
Oct 13, 2016 11:52:45 AM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
111247
Message:

FE/Qt: bugref:6899: Accessibility support (step 86): Qt5 accessibility crash protection for QITableView as usual.

File:
1 edited

Legend:

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

    r64232 r64238  
    351351    AssertPtrReturn(table(), 0);
    352352    /* Make sure index is valid: */
    353     AssertReturn(iIndex >= 0 && iIndex < childCount(), 0);
     353    AssertReturn(iIndex >= 0, 0);
     354    if (iIndex >= childCount())
     355    {
     356        // WORKAROUND:
     357        // Normally I would assert here, but Qt5 accessibility code has
     358        // a hard-coded architecture for a table-views which we do not like
     359        // but have to live with and this architecture enumerates cells
     360        // including header column and row, so Qt5 can try to address
     361        // our interface with index which surely out of bounds by our laws.
     362        // So let's assume that's exactly such case and try to enumerate
     363        // table cells including header column and row.
     364        // printf("Invalid index: %d\n", iIndex);
     365
     366        // Split delimeter is overall column count, including vertical header:
     367        const int iColumnCount = table()->model()->columnCount() + 1 /* v_header */;
     368        // Real index is zero-based, incoming is 1-based:
     369        const int iRealIndex = iIndex - 1;
     370        // Real row index, excluding horizontal header:
     371        const int iRealRowIndex = iRealIndex / iColumnCount - 1 /* h_header */;
     372        // printf("Actual row index: %d\n", iRealRowIndex);
     373
     374        // Return what we found:
     375        return iRealRowIndex >= 0 && iRealRowIndex < childCount() ?
     376               QAccessible::queryAccessibleInterface(table()->childItem(iRealRowIndex)) : 0;
     377    }
    354378
    355379    /* Return the child with the passed iIndex: */
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