diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-10-20 12:41:55 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-10-21 15:33:51 +0000 |
commit | bc546e14688c7056ac36b6f478fde852b5afaf46 (patch) | |
tree | 75cf4ed7146a362b11a9531d5314f03d738a3a96 /src/templates/qquickscrollbar.cpp | |
parent | 8e1df766cf9e74661b50de4f4ed489af5b4edfc8 (diff) |
QQuickControl: dynamically create a11y attached object
Using QAccessible::ActivationObserver approach.
Change-Id: Ib99c1f9b7b0c37a3e8a4747db265c9df77acc1f8
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src/templates/qquickscrollbar.cpp')
-rw-r--r-- | src/templates/qquickscrollbar.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/templates/qquickscrollbar.cpp b/src/templates/qquickscrollbar.cpp index 559efaaa..cb3e2766 100644 --- a/src/templates/qquickscrollbar.cpp +++ b/src/templates/qquickscrollbar.cpp @@ -81,7 +81,10 @@ class QQuickScrollBarPrivate : public QQuickControlPrivate public: QQuickScrollBarPrivate() : size(0), position(0), offset(0), active(false), pressed(false), moving(false), - orientation(Qt::Vertical), handle(Q_NULLPTR) { } + orientation(Qt::Vertical), handle(Q_NULLPTR) + { + m_accessibleRole = 0x00000003; // QAccessible::ScrollBar + } static QQuickScrollBarPrivate *get(QQuickScrollBar *bar) { @@ -103,7 +106,6 @@ QQuickScrollBar::QQuickScrollBar(QQuickItem *parent) : { setKeepMouseGrab(true); setAcceptedMouseButtons(Qt::LeftButton); - setAccessibleRole(0x00000003); //QAccessible::ScrollBar } QQuickScrollBarAttached *QQuickScrollBar::qmlAttachedProperties(QObject *object) @@ -287,6 +289,17 @@ qreal QQuickScrollBar::positionAt(const QPoint &point) const return point.y() / height(); } +#ifndef QT_NO_ACCESSIBILITY +void QQuickScrollBar::accessibilityActiveChanged(bool active) +{ + QQuickControl::accessibilityActiveChanged(active); + + Q_D(QQuickScrollBar); + if (active) + setAccessibleProperty("pressed", d->pressed); +} +#endif + class QQuickScrollBarAttachedPrivate : public QObjectPrivate, public QQuickItemChangeListener { public: |