From 7b32da4af8b6f305185d1c22d1425164b00e5391 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Fri, 15 Oct 2010 15:23:33 +0200 Subject: Cocoa: small update to 534ba3c7314820604ba5aeeffa6051c91e7c1d09 Rather than checking window level directly, we check the Qt window type. This has the advantage that we also include dialogs that are modal. --- src/gui/kernel/qwidget_mac.mm | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index b3b9183..997419b 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -2803,8 +2803,8 @@ void QWidgetPrivate::setSubWindowStacking(bool set) // a tool window, since it will normally hide when you deactivate the // application, Cocoa will hide the parent upon deactivate as well. The result often // being no more visible windows on screen. So, to make a long story short, we only - // allow parent-child relationships between windows that both are on the NSNormalWindowLevel - // (because Cocoa will also use the window level to decide upon strange behaviour). + // allow parent-child relationships between windows that both are either a plain window + // or a dialog. Q_Q(QWidget); if (!q->isWindow()) @@ -2812,7 +2812,8 @@ void QWidgetPrivate::setSubWindowStacking(bool set) NSWindow *qwin = [qt_mac_nativeview_for(q) window]; if (!qwin) return; - if (set && [qwin level] != NSNormalWindowLevel) + Qt::WindowType qtype = q->windowType(); + if (set && !(qtype == Qt::Window || qtype == Qt::Dialog)) return; if (set && ![qwin isVisible]) return; @@ -2820,7 +2821,8 @@ void QWidgetPrivate::setSubWindowStacking(bool set) if (QWidget *parent = q->parentWidget()) { if (NSWindow *pwin = [qt_mac_nativeview_for(parent) window]) { if (set) { - if ([pwin isVisible] && [pwin level] == NSNormalWindowLevel && ![qwin parentWindow]) + Qt::WindowType ptype = parent->window()->windowType(); + if ([pwin isVisible] && (ptype == Qt::Window || ptype == Qt::Dialog) && ![qwin parentWindow]) [pwin addChildWindow:qwin ordered:NSWindowAbove]; } else { [pwin removeChildWindow:qwin]; @@ -2834,7 +2836,8 @@ void QWidgetPrivate::setSubWindowStacking(bool set) if (child && child->isWindow()) { if (NSWindow *cwin = [qt_mac_nativeview_for(child) window]) { if (set) { - if ([cwin isVisible] && [cwin level] == NSNormalWindowLevel && ![cwin parentWindow]) + Qt::WindowType ctype = child->window()->windowType(); + if ([cwin isVisible] && (ctype == Qt::Window || ctype == Qt::Dialog) && ![cwin parentWindow]) [qwin addChildWindow:cwin ordered:NSWindowAbove]; } else { [qwin removeChildWindow:qt_mac_window_for(child)]; -- cgit v0.12