Accessibility: Fix reporting the same name/value twice

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 <jan-arve.saether@digia.com>
This commit is contained in:
Frederik Gladhorn 2014-02-06 11:46:03 +01:00 committed by The Qt Project
parent c8eb6d99d4
commit b96c075d22
3 changed files with 4 additions and 4 deletions

View File

@ -1068,7 +1068,6 @@ QString QAccessibleTableCell::text(QAccessible::Text t) const
QAbstractItemModel *model = view->model(); QAbstractItemModel *model = view->model();
QString value; QString value;
switch (t) { switch (t) {
case QAccessible::Value:
case QAccessible::Name: case QAccessible::Name:
value = model->data(m_index, Qt::AccessibleTextRole).toString(); value = model->data(m_index, Qt::AccessibleTextRole).toString();
if (value.isEmpty()) if (value.isEmpty())
@ -1160,7 +1159,6 @@ QString QAccessibleTableHeaderCell::text(QAccessible::Text t) const
QAbstractItemModel *model = view->model(); QAbstractItemModel *model = view->model();
QString value; QString value;
switch (t) { switch (t) {
case QAccessible::Value:
case QAccessible::Name: case QAccessible::Name:
value = model->headerData(index, orientation, Qt::AccessibleTextRole).toString(); value = model->headerData(index, orientation, Qt::AccessibleTextRole).toString();
if (value.isEmpty()) if (value.isEmpty())

View File

@ -631,7 +631,7 @@ QDockWidget *QAccessibleDockWidget::dockWidget() const
QString QAccessibleDockWidget::text(QAccessible::Text t) 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 qt_accStripAmp(dockWidget()->windowTitle());
} }
return QString(); return QString();

View File

@ -507,8 +507,10 @@ QString QAccessibleGroupBox::text(QAccessible::Text t) const
switch (t) { switch (t) {
case QAccessible::Name: case QAccessible::Name:
txt = qt_accStripAmp(groupBox()->title()); txt = qt_accStripAmp(groupBox()->title());
break;
case QAccessible::Description: case QAccessible::Description:
txt = qt_accStripAmp(groupBox()->title()); txt = qt_accStripAmp(groupBox()->toolTip());
break;
default: default:
break; break;
} }