Allow Windows accessibility backend to receive focus updates

The removed code no longer applies to the current Windows accessibility
backend, and was causing it to miss focus change events when the
application UI contained one or more widgets associated with native window
handles, or when the Qt::AA_NativeWindows application attribute was set.
This caused accessibility tools like Narrator to miss changes in the
focused widget.

Fixes: QTBUG-81862
Pick-to: 5.15
Change-Id: I6e42d09c54e9e1338fc4b103eba8a0b2c4309e7f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
Andre de la Rocha 2020-07-14 22:37:59 -03:00
parent 53496e67f0
commit 5f3f23462e

View File

@ -6349,11 +6349,6 @@ void QWidget::setFocus(Qt::FocusReason reason)
QApplicationPrivate::setFocusWidget(f, reason);
#ifndef QT_NO_ACCESSIBILITY
# ifdef Q_OS_WIN
// 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
// menus update the focus manually and this would create bogus events
if (!(f->inherits("QMenuBar") || f->inherits("QMenu") || f->inherits("QMenuItem")))
{