VirtualBox

Changeset 65257 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Jan 12, 2017 11:14:13 AM (8 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6899: Accessibility support (step 165): Basic accessibility interface for UISessionStateStatusBarIndicator.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp

    r65255 r65257  
    2121
    2222/* Qt includes: */
     23# include <QAccessibleWidget>
    2324# include <QTimer>
    2425# include <QPainter>
     
    9596
    9697
     98/** QAccessibleWidget extension used as an accessibility interface for UISessionStateStatusBarIndicator. */
     99class QIAccessibilityInterfaceForUISessionStateStatusBarIndicator : public QAccessibleWidget
     100{
     101public:
     102
     103    /** Returns an accessibility interface for passed @a strClassname and @a pObject. */
     104    static QAccessibleInterface *pFactory(const QString &strClassname, QObject *pObject)
     105    {
     106        /* Creating UISessionStateStatusBarIndicator accessibility interface: */
     107        if (pObject && strClassname == QLatin1String("UISessionStateStatusBarIndicator"))
     108            return new QIAccessibilityInterfaceForUISessionStateStatusBarIndicator(qobject_cast<QWidget*>(pObject));
     109
     110        /* Null by default: */
     111        return 0;
     112    }
     113
     114    /** Constructs an accessibility interface passing @a pWidget to the base-class. */
     115    QIAccessibilityInterfaceForUISessionStateStatusBarIndicator(QWidget *pWidget)
     116        : QAccessibleWidget(pWidget, QAccessible::Button)
     117    {}
     118
     119    /** Returns a text for the passed @a enmTextRole. */
     120    virtual QString text(QAccessible::Text /* enmTextRole */) const /* override */
     121    {
     122        /* Sanity check: */
     123        AssertPtrReturn(indicator(), 0);
     124
     125        /* Return the indicator description: */
     126        return indicator()->description();
     127    }
     128
     129private:
     130
     131    /** Returns corresponding UISessionStateStatusBarIndicator. */
     132    UISessionStateStatusBarIndicator *indicator() const { return qobject_cast<UISessionStateStatusBarIndicator*>(widget()); }
     133};
     134
     135
    97136UISessionStateStatusBarIndicator::UISessionStateStatusBarIndicator(IndicatorType enmType, UISession *pSession)
    98137    : m_enmType(enmType)
    99138    , m_pSession(pSession)
    100139{
     140    /* Install UISessionStateStatusBarIndicator accessibility interface factory: */
     141    QAccessible::installFactory(QIAccessibilityInterfaceForUISessionStateStatusBarIndicator::pFactory);
    101142}
    102143
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