Fix focus in Active Qt webbrowser.

Active X controls may cause WM_SETFOCUS/WM_KILLFOCUS to be sent to
native child windows. Ensure the focus widget is set correctly in
these cases.

Task-number: QTBUG-37126
Change-Id: I2a4cbb148eab48e47ca3f37b2076020c95d213a5
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
This commit is contained in:
Friedemann Kleint 2014-02-28 16:30:15 +01:00 committed by The Qt Project
parent 846cc4c75c
commit 9788c0f47c

View File

@ -143,6 +143,11 @@ void QApplicationPrivate::notifyActiveWindowChange(QWindow *previous)
return;
QWidget *tlw = qt_tlw_for_window(wnd);
QApplication::setActiveWindow(tlw);
// QTBUG-37126, Active X controls may set the focus on native child widgets.
if (wnd && tlw && wnd != tlw->windowHandle()) {
if (QWidgetWindow *widgetWindow = qobject_cast<QWidgetWindow *>(wnd))
widgetWindow->widget()->setFocus(Qt::ActiveWindowFocusReason);
}
}
static void ungrabKeyboardForPopup(QWidget *popup)