diff options
author | Frederik Gladhorn <frederik.gladhorn@nokia.com> | 2012-01-20 19:07:54 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-14 13:40:03 +0200 |
commit | eb52d31ddf59d43c2f8cd1e85613b60213fd6696 (patch) | |
tree | 789dd52d83f322b9cd5eda0f9b3dcdfe21fdd801 /src/widgets/widgets | |
parent | d80b00f3206291dc90433a95bd6c6aadc17be0bb (diff) |
Update accessibility selections in QTextControl.
Forwardport from Qt 4.
Change-Id: Iae0c2792b64b8ec2736a9ff621cf7c313a394093
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
(cherry picked from commit d5649547d641b9c5af3c3f814caf8e1ab5bf9f47)
Diffstat (limited to 'src/widgets/widgets')
-rw-r--r-- | src/widgets/widgets/qwidgettextcontrol.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp index d602d6daa5..91864b6608 100644 --- a/src/widgets/widgets/qwidgettextcontrol.cpp +++ b/src/widgets/widgets/qwidgettextcontrol.cpp @@ -79,6 +79,7 @@ #include <qtooltip.h> #include <qstyleoption.h> #include <QtWidgets/qlineedit.h> +#include <QtGui/qaccessible.h> #ifndef QT_NO_SHORTCUT #include "private/qapplication_p.h" @@ -577,8 +578,15 @@ void QWidgetTextControlPrivate::repaintOldAndNewSelection(const QTextCursor &old void QWidgetTextControlPrivate::selectionChanged(bool forceEmitSelectionChanged /*=false*/) { Q_Q(QWidgetTextControl); - if (forceEmitSelectionChanged) + if (forceEmitSelectionChanged) { emit q->selectionChanged(); +#ifndef QT_NO_ACCESSIBILITY + if (q->parent()) { + QAccessibleTextSelectionEvent ev(q->parent(), cursor.anchor(), cursor.position()); + QAccessible::updateAccessibility(&ev); + } +#endif + } if (cursor.position() == lastSelectionPosition && cursor.anchor() == lastSelectionAnchor) @@ -593,9 +601,15 @@ void QWidgetTextControlPrivate::selectionChanged(bool forceEmitSelectionChanged && (selectionStateChange || (cursor.hasSelection() && (cursor.position() != lastSelectionPosition - || cursor.anchor() != lastSelectionAnchor)))) + || cursor.anchor() != lastSelectionAnchor)))) { emit q->selectionChanged(); - +#ifndef QT_NO_ACCESSIBILITY + if (q->parent()) { + QAccessibleTextSelectionEvent ev(q->parent(), cursor.anchor(), cursor.position()); + QAccessible::updateAccessibility(&ev); + } +#endif + } emit q->microFocusChanged(); lastSelectionPosition = cursor.position(); lastSelectionAnchor = cursor.anchor(); |