VirtualBox

Changeset 64520 in vbox for trunk


Ignore:
Timestamp:
Nov 2, 2016 3:43:22 PM (8 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6899: Accessibility support (step 122): Extending QIComboBox API for accessibility needs.

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

Legend:

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

    r64519 r64520  
    4141}
    4242
     43int QIComboBox::subElementCount() const
     44{
     45    /* Depending on 'editable' property: */
     46    return !isEditable() ? SubElement_Max : SubElementEditable_Max;
     47}
     48
     49QWidget *QIComboBox::subElement(int iIndex) const
     50{
     51    /* Make sure index is inside the bounds: */
     52    AssertReturn(iIndex >= 0 && iIndex < subElementCount(), 0);
     53
     54    /* For 'non-editable' case: */
     55    if (!isEditable())
     56    {
     57        switch (iIndex)
     58        {
     59            case SubElement_Selector: return m_pComboBox;
     60            default: break;
     61        }
     62    }
     63    /* For 'editable' case: */
     64    else
     65    {
     66        switch (iIndex)
     67        {
     68            case SubElementEditable_Editor: return lineEdit();
     69            case SubElementEditable_Selector: return m_pComboBox;
     70            default: break;
     71        }
     72    }
     73
     74    /* Null otherwise: */
     75    return 0;
     76}
     77
    4378QLineEdit *QIComboBox::lineEdit() const
    4479{
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIComboBox.h

    r64519 r64520  
    2828    Q_OBJECT;
    2929
     30    /** Enumerates sub-element indexes for basic case. */
     31    enum { SubElement_Selector, SubElement_Max };
     32    /** Enumerates sub-element indexes for editable case. */
     33    enum { SubElementEditable_Editor, SubElementEditable_Selector, SubElementEditable_Max };
     34
    3035public:
    3136
    3237    /** Constructs combo-box passing @a pParent to the base-class. */
    3338    QIComboBox(QWidget *pParent = 0);
     39
     40    /** Returns sub-element count. */
     41    int subElementCount() const;
     42    /** Returns sub-element with passed @a iIndex. */
     43    QWidget *subElement(int iIndex) const;
    3444
    3545    /** Returns the embedded line-editor reference. */
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