diff options
author | Andy Shaw <andy.shaw@theqtcompany.com> | 2015-11-06 11:03:15 +0100 |
---|---|---|
committer | Andy Shaw <andy.shaw@theqtcompany.com> | 2015-11-23 12:22:13 +0000 |
commit | b21c219811f2363002e3cc96c8cfef849aaa95a4 (patch) | |
tree | b3114f6166e68657b48b8bb5afefd292e58af27b /src/widgets/kernel | |
parent | 2010eff9d71d90953694c322ceebd340b7adef5f (diff) |
Call setFocus() if it is a QAxHostWidget which is in a new active window
The change 8c0f47cfae17a39137dec47aa0b9f3f9bedad introduced a problem
where if the widget was being reparented had a valid HWND then it would
cause the focus to change inside the already active window. Therefore we
need to limit the times it does this to the case where we know it needs to
be done which is the ActiveQt case.
Change-Id: Ia85f5136661142b25952e0ebf66f8a43d9500d58
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 647484ece1..078feb4b03 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -2248,8 +2248,10 @@ void QApplicationPrivate::notifyActiveWindowChange(QWindow *previous) 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); + if (QWidgetWindow *widgetWindow = qobject_cast<QWidgetWindow *>(wnd)) { + if (widgetWindow->widget()->inherits("QAxHostWidget")) + widgetWindow->widget()->setFocus(Qt::ActiveWindowFocusReason); + } } } |