VirtualBox

Changeset 64780 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Dec 2, 2016 2:56:31 PM (8 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6899: Accessibility support (step 147): Extending few more QITreeWidgetItem sub-classes with properly accessible text, s.a. r112131.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.cpp

    r64778 r64780  
    9797    virtual QString defaultText() const /* override */
    9898    {
    99         return tr("%1, %2: %3, %4: %5, %6: %7",
     99        return parentItem() ?
     100               tr("%1, %2: %3, %4: %5, %6: %7",
    100101                  "col.1 text, col.2 name: col.2 text, col.3 name: col.3 text, col.4 name: col.4 text")
    101102                 .arg(text(0))
    102103                 .arg(parentTree()->headerItem()->text(1)).arg(text(1))
    103104                 .arg(parentTree()->headerItem()->text(2)).arg(text(2))
    104                  .arg(parentTree()->headerItem()->text(3)).arg(text(3));
     105                 .arg(parentTree()->headerItem()->text(3)).arg(text(3)) :
     106               text(0);
    105107    }
    106108
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp

    r64358 r64780  
    149149    CConsole m_console;
    150150};
     151
     152
     153/** QITreeWidgetItem extension representing USB filter item. */
     154class UIUSBFilterItem : public QITreeWidgetItem
     155{
     156public:
     157
     158    /** Constructs USB filter item. */
     159    UIUSBFilterItem() {}
     160
     161protected:
     162
     163    /** Returns default text. */
     164    virtual QString defaultText() const /* override */
     165    {
     166        return checkState(0) == Qt::Checked ?
     167               tr("%1, Active", "col.1 text, col.1 state").arg(text(0)) :
     168               tr("%1",         "col.1 text")             .arg(text(0));
     169    }
     170};
     171
    151172
    152173UIMachineSettingsUSB::UIMachineSettingsUSB()
     
    849870
    850871    /* Append tree-widget with item: */
    851     QITreeWidgetItem *pItem = new QITreeWidgetItem;
     872    UIUSBFilterItem *pItem = new UIUSBFilterItem;
    852873    pItem->setCheckState(0, usbFilterData.m_fActive ? Qt::Checked : Qt::Unchecked);
    853874    pItem->setText(0, usbFilterData.m_strName);
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