From b96c075d22ce38048bedb860c04b74125720fb30 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Thu, 6 Feb 2014 11:46:03 +0100 Subject: [PATCH] Accessibility: Fix reporting the same name/value twice MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit NVDA for example reads name and value, so that most of our accessibles would lead to the same text being read twice in a row. Instead use Name as that's best supported on all platforms. [ChangedLog][QtWidgets] Fixed accessibility issues that would lead to screen readers reading the same text twice. Task-number: QTBUG-36678 Change-Id: I6c5c9cdcf5392c7135a65bd30f87a590c3c07fb4 Reviewed-by: Jan Arve Sæther --- src/plugins/accessible/widgets/itemviews.cpp | 2 -- src/plugins/accessible/widgets/qaccessiblewidgets.cpp | 2 +- src/plugins/accessible/widgets/simplewidgets.cpp | 4 +++- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/accessible/widgets/itemviews.cpp b/src/plugins/accessible/widgets/itemviews.cpp index b477a6acb7..b24106d223 100644 --- a/src/plugins/accessible/widgets/itemviews.cpp +++ b/src/plugins/accessible/widgets/itemviews.cpp @@ -1068,7 +1068,6 @@ QString QAccessibleTableCell::text(QAccessible::Text t) const QAbstractItemModel *model = view->model(); QString value; switch (t) { - case QAccessible::Value: case QAccessible::Name: value = model->data(m_index, Qt::AccessibleTextRole).toString(); if (value.isEmpty()) @@ -1160,7 +1159,6 @@ QString QAccessibleTableHeaderCell::text(QAccessible::Text t) const QAbstractItemModel *model = view->model(); QString value; switch (t) { - case QAccessible::Value: case QAccessible::Name: value = model->headerData(index, orientation, Qt::AccessibleTextRole).toString(); if (value.isEmpty()) diff --git a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp index 79a5c82fe0..71d22eabc4 100644 --- a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp +++ b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp @@ -631,7 +631,7 @@ QDockWidget *QAccessibleDockWidget::dockWidget() const QString QAccessibleDockWidget::text(QAccessible::Text t) const { - if (t == QAccessible::Name || t == QAccessible::Value) { + if (t == QAccessible::Name) { return qt_accStripAmp(dockWidget()->windowTitle()); } return QString(); diff --git a/src/plugins/accessible/widgets/simplewidgets.cpp b/src/plugins/accessible/widgets/simplewidgets.cpp index c275ec071d..893be2df04 100644 --- a/src/plugins/accessible/widgets/simplewidgets.cpp +++ b/src/plugins/accessible/widgets/simplewidgets.cpp @@ -507,8 +507,10 @@ QString QAccessibleGroupBox::text(QAccessible::Text t) const switch (t) { case QAccessible::Name: txt = qt_accStripAmp(groupBox()->title()); + break; case QAccessible::Description: - txt = qt_accStripAmp(groupBox()->title()); + txt = qt_accStripAmp(groupBox()->toolTip()); + break; default: break; }