From: Frederik Gladhorn Date: Sun, 5 Jun 2011 11:16:13 +0000 (-0700) Subject: Avoid bogus accessibility focus events from menus. X-Git-Tag: qt-v5.0.0-alpha1~3800 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5af6a09b6faf55bf70237913f49dcf4ba2358f52;p=profile%2Fivi%2Fqtbase.git 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 Reviewed-by: Frederik Gladhorn --- diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 60f2064..231fc26 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -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