Accessibility Windows: Improve Menus

This would especially trigger when moving the focus between menus - after
the right menu got the focus we would send another event for the QMenuBar,
preventing the screen reader from reading the actually selected menu,
announcing the menu bar instead.

[ChangeLog][QtWidgets][QMenu] Accessibility: Menus are read by screen
readers with more reliability.

Task-number: QTBUG-38498
Change-Id: Ie4028120b234949380315296bf07ca53863d0ad8
Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
This commit is contained in:
Frederik Gladhorn 2014-04-23 13:27:55 +02:00 committed by The Qt Project
parent 58e48831f1
commit aa920e6274
3 changed files with 0 additions and 8 deletions

View File

@ -6002,10 +6002,8 @@ void QWidget::setFocus(Qt::FocusReason reason)
if (!(testAttribute(Qt::WA_WState_Created) && window()->windowType() != Qt::Popup && internalWinId()))
//setFocusWidget will already post a focus event for us (that the AT client receives) on Windows
# endif
# ifdef Q_OS_UNIX
// menus update the focus manually and this would create bogus events
if (!(f->inherits("QMenuBar") || f->inherits("QMenu") || f->inherits("QMenuItem")))
# endif
{
QAccessibleEvent event(f, QAccessible::Focus);
QAccessible::updateAccessibility(&event);

View File

@ -1091,9 +1091,6 @@ void QMenuPrivate::activateAction(QAction *action, QAction::ActionEvent action_e
QAccessibleEvent focusEvent(q, QAccessible::Focus);
focusEvent.setChild(actionIndex);
QAccessible::updateAccessibility(&focusEvent);
QAccessibleEvent selectionEvent(q, QAccessible::Selection);
focusEvent.setChild(actionIndex);
QAccessible::updateAccessibility(&selectionEvent);
}
#endif
action->showStatusText(topCausedWidget());

View File

@ -531,9 +531,6 @@ void QMenuBarPrivate::_q_actionHovered()
QAccessibleEvent focusEvent(q, QAccessible::Focus);
focusEvent.setChild(actionIndex);
QAccessible::updateAccessibility(&focusEvent);
QAccessibleEvent selectionEvent(q, QAccessible::Selection);
selectionEvent.setChild(actionIndex);
QAccessible::updateAccessibility(&selectionEvent);
}
#endif //QT_NO_ACCESSIBILITY
}