diff options
author | Frederik Gladhorn <[email protected]> | 2014-10-27 16:31:47 +0100 |
---|---|---|
committer | Jan Arve Sæther <[email protected]> | 2014-11-06 14:05:47 +0100 |
commit | e22fc141c3fc5362f9b906c43a1b7c0dbc1f85a3 (patch) | |
tree | 0871fc3cb1e02d0eee5b445615677d3ce701eae3 | |
parent | 4876c2aa95a58dd9dd17e94e7e725ceea5047d26 (diff) |
Add scroll and page accessible actions
Task-number: QTBUG-39189
Task-number: QTBUG-41980
Change-Id: I135c1b4fcf609a65b3895177385d236b50dfac6f
Reviewed-by: Jan Arve Sæther <[email protected]>
-rw-r--r-- | src/quick/items/qquickaccessibleattached.cpp | 79 | ||||
-rw-r--r-- | src/quick/items/qquickaccessibleattached_p.h | 12 |
2 files changed, 90 insertions, 1 deletions
diff --git a/src/quick/items/qquickaccessibleattached.cpp b/src/quick/items/qquickaccessibleattached.cpp index abb763c2eb..a7641523ea 100644 --- a/src/quick/items/qquickaccessibleattached.cpp +++ b/src/quick/items/qquickaccessibleattached.cpp @@ -291,11 +291,59 @@ QT_BEGIN_NAMESPACE The corresponding handler is \c onDecreaseAction. */ +/*! + \qmlsignal QtQuick::Accessible::scrollUpAction() + + This signal is emitted when a scroll up action is received from an assistive tool such as a screen-reader. + + The corresponding handler is \c onScrollUpAction. +*/ +/*! + \qmlsignal QtQuick::Accessible::scrollDownAction() + + This signal is emitted when a scroll down action is received from an assistive tool such as a screen-reader. + + The corresponding handler is \c onScrollDownAction. +*/ +/*! + \qmlsignal QtQuick::Accessible::scrollLeftAction() + + This signal is emitted when a scroll left action is received from an assistive tool such as a screen-reader. + + The corresponding handler is \c onScrollLeftAction. +*/ +/*! + \qmlsignal QtQuick::Accessible::scrollRightAction() + + This signal is emitted when a scroll right action is received from an assistive tool such as a screen-reader. + + The corresponding handler is \c onScrollRightAction. +*/ +/*! + \qmlsignal QtQuick::Accessible::previousPageAction() + + This signal is emitted when a previous page action is received from an assistive tool such as a screen-reader. + + The corresponding handler is \c onPreviousPageAction. +*/ +/*! + \qmlsignal QtQuick::Accessible::nextPageAction() + + This signal is emitted when a next page action is received from an assistive tool such as a screen-reader. + + The corresponding handler is \c onNextPageAction. +*/ QMetaMethod QQuickAccessibleAttached::sigPress; QMetaMethod QQuickAccessibleAttached::sigToggle; QMetaMethod QQuickAccessibleAttached::sigIncrease; QMetaMethod QQuickAccessibleAttached::sigDecrease; +QMetaMethod QQuickAccessibleAttached::sigScrollUp; +QMetaMethod QQuickAccessibleAttached::sigScrollDown; +QMetaMethod QQuickAccessibleAttached::sigScrollLeft; +QMetaMethod QQuickAccessibleAttached::sigScrollRight; +QMetaMethod QQuickAccessibleAttached::sigPreviousPage; +QMetaMethod QQuickAccessibleAttached::sigNextPage; QQuickAccessibleAttached::QQuickAccessibleAttached(QObject *parent) : QObject(parent), m_role(QAccessible::NoRole) @@ -323,6 +371,12 @@ QQuickAccessibleAttached::QQuickAccessibleAttached(QObject *parent) sigToggle = QMetaMethod::fromSignal(&QQuickAccessibleAttached::toggleAction); sigIncrease = QMetaMethod::fromSignal(&QQuickAccessibleAttached::increaseAction); sigDecrease = QMetaMethod::fromSignal(&QQuickAccessibleAttached::decreaseAction); + sigScrollUp = QMetaMethod::fromSignal(&QQuickAccessibleAttached::scrollUpAction); + sigScrollDown = QMetaMethod::fromSignal(&QQuickAccessibleAttached::scrollDownAction); + sigScrollLeft = QMetaMethod::fromSignal(&QQuickAccessibleAttached::scrollLeftAction); + sigScrollRight = QMetaMethod::fromSignal(&QQuickAccessibleAttached::scrollRightAction); + sigPreviousPage = QMetaMethod::fromSignal(&QQuickAccessibleAttached::previousPageAction); + sigNextPage= QMetaMethod::fromSignal(&QQuickAccessibleAttached::nextPageAction); } } @@ -359,7 +413,18 @@ bool QQuickAccessibleAttached::doAction(const QString &actionName) sig = &sigIncrease; else if (actionName == QAccessibleActionInterface::decreaseAction()) sig = &sigDecrease; - + else if (actionName == QAccessibleActionInterface::scrollUpAction()) + sig = &sigScrollUp; + else if (actionName == QAccessibleActionInterface::scrollDownAction()) + sig = &sigScrollDown; + else if (actionName == QAccessibleActionInterface::scrollLeftAction()) + sig = &sigScrollLeft; + else if (actionName == QAccessibleActionInterface::scrollRightAction()) + sig = &sigScrollRight; + else if (actionName == QAccessibleActionInterface::previousPageAction()) + sig = &sigPreviousPage; + else if (actionName == QAccessibleActionInterface::nextPageAction()) + sig = &sigNextPage; if (sig && isSignalConnected(*sig)) return sig->invoke(this); return false; @@ -375,6 +440,18 @@ void QQuickAccessibleAttached::availableActions(QStringList *actions) const actions->append(QAccessibleActionInterface::increaseAction()); if (isSignalConnected(sigDecrease)) actions->append(QAccessibleActionInterface::decreaseAction()); + if (isSignalConnected(sigScrollUp)) + actions->append(QAccessibleActionInterface::scrollUpAction()); + if (isSignalConnected(sigScrollDown)) + actions->append(QAccessibleActionInterface::scrollDownAction()); + if (isSignalConnected(sigScrollLeft)) + actions->append(QAccessibleActionInterface::scrollLeftAction()); + if (isSignalConnected(sigScrollRight)) + actions->append(QAccessibleActionInterface::scrollRightAction()); + if (isSignalConnected(sigPreviousPage)) + actions->append(QAccessibleActionInterface::previousPageAction()); + if (isSignalConnected(sigNextPage)) + actions->append(QAccessibleActionInterface::nextPageAction()); } QT_END_NAMESPACE diff --git a/src/quick/items/qquickaccessibleattached_p.h b/src/quick/items/qquickaccessibleattached_p.h index ad6165f936..6286c56d2c 100644 --- a/src/quick/items/qquickaccessibleattached_p.h +++ b/src/quick/items/qquickaccessibleattached_p.h @@ -212,6 +212,12 @@ Q_SIGNALS: void toggleAction(); void increaseAction(); void decreaseAction(); + void scrollUpAction(); + void scrollDownAction(); + void scrollLeftAction(); + void scrollRightAction(); + void previousPageAction(); + void nextPageAction(); private: QQuickItem *item() const { return static_cast<QQuickItem*>(parent()); } @@ -225,6 +231,12 @@ private: static QMetaMethod sigToggle; static QMetaMethod sigIncrease; static QMetaMethod sigDecrease; + static QMetaMethod sigScrollUp; + static QMetaMethod sigScrollDown; + static QMetaMethod sigScrollLeft; + static QMetaMethod sigScrollRight; + static QMetaMethod sigPreviousPage; + static QMetaMethod sigNextPage; public: using QObject::property; |