src/gui/kernel/qwidget_mac.mm
changeset 37 758a864f9613
parent 33 3e2da88830cd
--- a/src/gui/kernel/qwidget_mac.mm	Fri Sep 17 08:34:18 2010 +0300
+++ b/src/gui/kernel/qwidget_mac.mm	Mon Oct 04 01:19:32 2010 +0300
@@ -2796,10 +2796,14 @@
 
     if (QWidget *parent = q->parentWidget()) {
         if (parent->testAttribute(Qt::WA_WState_Created)) {
-            if (set)
-                [qt_mac_window_for(parent) addChildWindow:qt_mac_window_for(q) ordered:NSWindowAbove];
-            else
+            if (set) {
+                if (parent->isVisible()) {
+                    NSWindow *childwin = qt_mac_window_for(q);
+                    [qt_mac_window_for(parent) addChildWindow:childwin ordered:NSWindowAbove];
+                }
+            } else {
                 [qt_mac_window_for(parent) removeChildWindow:qt_mac_window_for(q)];
+            }
         }
     }
 
@@ -2807,10 +2811,12 @@
     for (int i=0; i<widgets.size(); ++i) {
         QWidget *child = widgets.at(i);
         if (child->isWindow() && child->testAttribute(Qt::WA_WState_Created) && child->isVisibleTo(q)) {
-            if (set)
-                [qt_mac_window_for(q) addChildWindow:qt_mac_window_for(child) ordered:NSWindowAbove];
-            else
+            if (set) {
+                NSWindow *childwin = qt_mac_window_for(child);
+                [qt_mac_window_for(q) addChildWindow:childwin ordered:NSWindowAbove];
+            } else {
                 [qt_mac_window_for(q) removeChildWindow:qt_mac_window_for(child)];
+            }
         }
     }
 }