diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-10-04 10:34:21 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-10-05 15:10:52 +0000 |
commit | bde6a049494f40cd71004d6926899f115af0c3e6 (patch) | |
tree | 6c49f238eee1945e4fccf07001df1bb1a864d6e5 /src/widgets/kernel | |
parent | 2bd6f5e8d13e60f0d1102c8e4e53ee341146308c (diff) |
QtWidgets: Fix Qt application coming to the foreground when launching app by popup menu
Check on the application state before requesting activation.
Fixes: QTBUG-70810
Change-Id: I550137dc00209b17f4b3c033287ceef1b871ff50
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 09a08fac14..6753c35cfc 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -6600,9 +6600,12 @@ QWidget *QWidgetPrivate::deepestFocusProxy() const void QWidgetPrivate::setFocus_sys() { Q_Q(QWidget); - // Embedded native widget may have taken the focus; get it back to toplevel if that is the case + // Embedded native widget may have taken the focus; get it back to toplevel + // if that is the case (QTBUG-25852) const QWidget *topLevel = q->window(); - if (topLevel->windowType() != Qt::Popup) { + // Do not activate in case the popup menu opens another application (QTBUG-70810). + if (QGuiApplication::applicationState() == Qt::ApplicationActive + && topLevel->windowType() != Qt::Popup) { if (QWindow *nativeWindow = q->window()->windowHandle()) { if (nativeWindow != QGuiApplication::focusWindow() && q->testAttribute(Qt::WA_WState_Created)) { |