aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquicktextinput.cpp
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2012-11-04 12:54:30 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-12-19 14:59:06 +0100
commitc8ef32e2b6cded37a6854b94a281464c1b7a298b (patch)
tree3f88b1184ba65c1bfe51ffae52c5fd28d98c48ae /src/quick/items/qquicktextinput.cpp
parent29152ec5208261e3d1ad8fa7de4d22efce3de813 (diff)
Accessibility: Improve interface handling in Quick
This changes how interfaces are handled: the QAccessibleQuickItem will simply subclass all interfaces and dynamically return 0 or the appropriate interface_cast. This makes our implementation a lot more flexible. To make use of the value interface, only a value property is needed (together with a corresponding role). Since the implementation of the interfaces became simpler, the value interface and some text interface improvements go along with the change. Change-Id: I003ec3016d48d730a4acac467bce322167842f4d Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
Diffstat (limited to 'src/quick/items/qquicktextinput.cpp')
-rw-r--r--src/quick/items/qquicktextinput.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp
index fee49593ee..6dd8fb157d 100644
--- a/src/quick/items/qquicktextinput.cpp
+++ b/src/quick/items/qquicktextinput.cpp
@@ -59,6 +59,7 @@
#ifndef QT_NO_ACCESSIBILITY
#include "qaccessible.h"
+#include "qquickaccessibleattached_p.h"
#endif
QT_BEGIN_NAMESPACE
@@ -3374,9 +3375,11 @@ void QQuickTextInputPrivate::internalSetText(const QString &txt, int pos, bool e
#ifdef QT_NO_ACCESSIBILITY
Q_UNUSED(changed)
#else
- if (changed) {
- QAccessibleTextUpdateEvent ev(q, 0, oldText, m_text);
- QAccessible::updateAccessibility(&ev);
+ if (changed && QAccessible::isActive()) {
+ if (QObject *acc = QQuickAccessibleAttached::findAccessible(q, QAccessible::EditableText)) {
+ QAccessibleTextUpdateEvent ev(acc, 0, oldText, m_text);
+ QAccessible::updateAccessibility(&ev);
+ }
}
#endif
}
@@ -4025,8 +4028,12 @@ bool QQuickTextInputPrivate::emitCursorPositionChanged()
}
#ifndef QT_NO_ACCESSIBILITY
- QAccessibleTextCursorEvent ev(q, m_cursor);
- QAccessible::updateAccessibility(&ev);
+ if (QAccessible::isActive()) {
+ if (QObject *acc = QQuickAccessibleAttached::findAccessible(q, QAccessible::EditableText)) {
+ QAccessibleTextCursorEvent ev(acc, m_cursor);
+ QAccessible::updateAccessibility(&ev);
+ }
+ }
#endif
return true;