summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@nokia.com>2010-10-15 13:23:33 (GMT)
committerRichard Moe Gustavsen <richard.gustavsen@nokia.com>2010-10-15 13:26:27 (GMT)
commit7b32da4af8b6f305185d1c22d1425164b00e5391 (patch)
tree63fb551384d2eb92a63e5d0a12ea78b1901d272a
parent82e03a66d18a27ea06dfa35f1e236bbe9ef972f7 (diff)
downloadQt-7b32da4af8b6f305185d1c22d1425164b00e5391.zip
Qt-7b32da4af8b6f305185d1c22d1425164b00e5391.tar.gz
Qt-7b32da4af8b6f305185d1c22d1425164b00e5391.tar.bz2
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.
-rw-r--r--src/gui/kernel/qwidget_mac.mm13
1 files 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)];