summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/widgets/kernel/qwidget.cpp7
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)) {