Avoid bogus accessibility focus events from menus.
authorFrederik Gladhorn <frederik.gladhorn@nokia.com>
Sun, 5 Jun 2011 11:16:13 +0000 (04:16 -0700)
committerQt by Nokia <qt-info@nokia.com>
Thu, 18 Aug 2011 13:50:50 +0000 (15:50 +0200)
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>
src/gui/kernel/qwidget.cpp

index 60f2064..231fc26 100644 (file)
@@ -6444,6 +6444,10 @@ 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
             QAccessible::updateAccessibility(f, 0, QAccessible::Focus);
 #endif
 #ifndef QT_NO_GRAPHICSVIEW