summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qapplication_qpa.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2014-02-28 16:30:15 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-28 21:27:41 +0100
commit9788c0f47cfae17a39137dec47aa0b9f3f9bedad (patch)
tree40e145adeaa2b5f5249f8febcce834c1844ba912 /src/widgets/kernel/qapplication_qpa.cpp
parent846cc4c75cc06def67e831c8cb3c9edaef24f8f0 (diff)
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>
Diffstat (limited to 'src/widgets/kernel/qapplication_qpa.cpp')
-rw-r--r--src/widgets/kernel/qapplication_qpa.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/widgets/kernel/qapplication_qpa.cpp b/src/widgets/kernel/qapplication_qpa.cpp
index 7977ae3528..5ce2ac2c4b 100644
--- a/src/widgets/kernel/qapplication_qpa.cpp
+++ b/src/widgets/kernel/qapplication_qpa.cpp
@@ -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)