diff options
| author | Frederik Gladhorn <[email protected]> | 2014-05-30 14:13:30 +0200 |
|---|---|---|
| committer | The Qt Project <[email protected]> | 2014-05-31 17:12:58 +0200 |
| commit | bb794270ec6cffb5f95bd7d18056b9e7bede7baa (patch) | |
| tree | ec5c7813a1b6b5898694e5cfa8a819508faabd76 | |
| parent | 739ad76846bc3d49472aacad9ed056cda314e26f (diff) | |
Accessibility: Fix select state usage
The selectable/selected states refer to items in a list and similar,
do not interpret them as text selection states.
Without this change NVDA for example announces text edits as selected
which makes no sense and which it doesn't do for native text items.
Change-Id: Ib1d109523bd4cc2b9b40ace8a8c3d7d3a7f9f25c
Reviewed-by: Jan Arve Sæther <[email protected]>
| -rw-r--r-- | src/gui/accessible/qaccessible.cpp | 2 | ||||
| -rw-r--r-- | src/widgets/accessible/qaccessiblewidgets.cpp | 1 | ||||
| -rw-r--r-- | src/widgets/accessible/simplewidgets.cpp | 4 | ||||
| -rw-r--r-- | tests/auto/other/qaccessibility/tst_qaccessibility.cpp | 12 |
4 files changed, 13 insertions, 6 deletions
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp index f7a4a537163..736d66fdae6 100644 --- a/src/gui/accessible/qaccessible.cpp +++ b/src/gui/accessible/qaccessible.cpp @@ -176,7 +176,7 @@ QT_BEGIN_NAMESPACE \value readOnly The object can usually be edited, but is explicitly set to read-only. \value selectable The object is selectable. \value selectableText The object has text which can be selected. This is different from selectable which refers to the object's children. - \value selected The object is selected. + \value selected The object is selected, this is independent of text selection. \value selfVoicing The object describes itself through speech or sound. \value sizeable The object can be resized, e.g. top-level windows. \value summaryElement The object summarizes the state of the window and should be treated with priority. diff --git a/src/widgets/accessible/qaccessiblewidgets.cpp b/src/widgets/accessible/qaccessiblewidgets.cpp index afef14485f9..d695bdcbc46 100644 --- a/src/widgets/accessible/qaccessiblewidgets.cpp +++ b/src/widgets/accessible/qaccessiblewidgets.cpp @@ -652,6 +652,7 @@ QAccessibleTextWidget::QAccessibleTextWidget(QWidget *o, QAccessible::Role r, co QAccessible::State QAccessibleTextWidget::state() const { QAccessible::State s = QAccessibleWidget::state(); + s.selectableText = true; s.multiLine = true; return s; } diff --git a/src/widgets/accessible/simplewidgets.cpp b/src/widgets/accessible/simplewidgets.cpp index 2cd960cfcf2..5612aa2e756 100644 --- a/src/widgets/accessible/simplewidgets.cpp +++ b/src/widgets/accessible/simplewidgets.cpp @@ -663,10 +663,8 @@ QAccessible::State QAccessibleLineEdit::state() const if (l->echoMode() != QLineEdit::Normal) state.passwordEdit = true; - state.selectable = true; - if (l->hasSelectedText()) - state.selected = true; + state.selectableText = true; return state; } diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp index 9387574c686..d6b193a288f 100644 --- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp @@ -1659,6 +1659,11 @@ void tst_QAccessibility::textEditTest() QTest::qWaitForWindowShown(&edit); QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(&edit); QCOMPARE(iface->text(QAccessible::Value), edit.toPlainText()); + QVERIFY(iface->state().focusable); + QVERIFY(!iface->state().selectable); + QVERIFY(!iface->state().selected); + QVERIFY(iface->state().selectableText); + QAccessibleTextInterface *textIface = iface->textInterface(); QVERIFY(textIface); @@ -1936,7 +1941,8 @@ void tst_QAccessibility::lineEditTest() QVERIFY(iface->state().sizeable); QVERIFY(iface->state().movable); QVERIFY(iface->state().focusable); - QVERIFY(iface->state().selectable); + QVERIFY(!iface->state().selectable); + QVERIFY(iface->state().selectableText); QVERIFY(!iface->state().hasPopup); QCOMPARE(bool(iface->state().focused), le->hasFocus()); @@ -1964,7 +1970,9 @@ void tst_QAccessibility::lineEditTest() QVERIFY(!(iface->state().sizeable)); QVERIFY(!(iface->state().movable)); QVERIFY(iface->state().focusable); - QVERIFY(iface->state().selectable); + QVERIFY(!iface->state().selectable); + QVERIFY(!iface->state().selected); + QVERIFY(iface->state().selectableText); QVERIFY(!iface->state().hasPopup); QCOMPARE(bool(iface->state().focused), le->hasFocus()); |
