summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoawindow.mm
diff options
context:
space:
mode:
authorTimur Pocheptsov <timur.pocheptsov@theqtcompany.com>2015-09-21 15:35:10 +0200
committerFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2015-09-26 21:44:56 +0000
commit593ab638609eb33542cf47b1693e70d6dbd7093b (patch)
treeb9af1b3b568732921edff79fb8dfba67948fc562 /src/plugins/platforms/cocoa/qcocoawindow.mm
parent3719245dc34f0054930f5d595856863c52059ba8 (diff)
Cocoa integration - do not make a window key during modal session
It can happen that we create a new window and make it visible during a modal session. In this case making a window into the new key window looks quite strange and misleading - since we're in a modal session, this window is completely inactive/useless. Use orderFront instead. Change-Id: Ic091e263508b452be4b5adf799a06017b044e441 Task-number: QTBUG-46304 Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoawindow.mm')
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index b12814ae83..543fcd50d1 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -686,7 +686,16 @@ void QCocoaWindow::setVisible(bool visible)
cocoaEventDispatcherPrivate->beginModalSession(window());
m_hasModalSession = true;
} else if ([m_nsWindow canBecomeKeyWindow]) {
- [m_nsWindow makeKeyAndOrderFront:nil];
+ QCocoaEventDispatcher *cocoaEventDispatcher = qobject_cast<QCocoaEventDispatcher *>(QGuiApplication::instance()->eventDispatcher());
+ QCocoaEventDispatcherPrivate *cocoaEventDispatcherPrivate = 0;
+ if (cocoaEventDispatcher)
+ cocoaEventDispatcherPrivate = static_cast<QCocoaEventDispatcherPrivate *>(QObjectPrivate::get(cocoaEventDispatcher));
+
+ if (!(cocoaEventDispatcherPrivate && cocoaEventDispatcherPrivate->currentModalSession()))
+ [m_nsWindow makeKeyAndOrderFront:nil];
+ else
+ [m_nsWindow orderFront:nil];
+
foreach (QCocoaWindow *childWindow, m_childWindows)
childWindow->show(true);
} else {