Avoid bogus accessibility focus events from menus.

Do not send accessibility focus events when menus are involved.
There are focus events to preserve the old focus when showing a new popup window.

Reviewed-by: Jan-Arve
(cherry picked from commit 32079bb0b348ef5f7126e69be9bcfb249c1a6412)

Change-Id: Id4838a3aede1d60a1850385e97660d085f055d64
Reviewed-on: http://codereview.qt.nokia.com/3021
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
This commit is contained in:
Frederik Gladhorn 2011-06-05 04:16:13 -07:00 committed by Qt by Nokia
parent 8d16fcb912
commit 5af6a09b6f

View File

@ -6443,6 +6443,10 @@ void QWidget::setFocus(Qt::FocusReason reason)
// The negation of the condition in setFocus_sys
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
QAccessible::updateAccessibility(f, 0, QAccessible::Focus);
#endif