src/gui/kernel/qwidget_mac.mm
changeset 37 758a864f9613
parent 33 3e2da88830cd
equal deleted inserted replaced
36:ef0373b55136 37:758a864f9613
  2794     if (!q->isWindow() || !q->testAttribute(Qt::WA_WState_Created))
  2794     if (!q->isWindow() || !q->testAttribute(Qt::WA_WState_Created))
  2795         return;
  2795         return;
  2796 
  2796 
  2797     if (QWidget *parent = q->parentWidget()) {
  2797     if (QWidget *parent = q->parentWidget()) {
  2798         if (parent->testAttribute(Qt::WA_WState_Created)) {
  2798         if (parent->testAttribute(Qt::WA_WState_Created)) {
  2799             if (set)
  2799             if (set) {
  2800                 [qt_mac_window_for(parent) addChildWindow:qt_mac_window_for(q) ordered:NSWindowAbove];
  2800                 if (parent->isVisible()) {
  2801             else
  2801                     NSWindow *childwin = qt_mac_window_for(q);
       
  2802                     [qt_mac_window_for(parent) addChildWindow:childwin ordered:NSWindowAbove];
       
  2803                 }
       
  2804             } else {
  2802                 [qt_mac_window_for(parent) removeChildWindow:qt_mac_window_for(q)];
  2805                 [qt_mac_window_for(parent) removeChildWindow:qt_mac_window_for(q)];
       
  2806             }
  2803         }
  2807         }
  2804     }
  2808     }
  2805 
  2809 
  2806     QList<QWidget *> widgets = q->findChildren<QWidget *>();
  2810     QList<QWidget *> widgets = q->findChildren<QWidget *>();
  2807     for (int i=0; i<widgets.size(); ++i) {
  2811     for (int i=0; i<widgets.size(); ++i) {
  2808         QWidget *child = widgets.at(i);
  2812         QWidget *child = widgets.at(i);
  2809         if (child->isWindow() && child->testAttribute(Qt::WA_WState_Created) && child->isVisibleTo(q)) {
  2813         if (child->isWindow() && child->testAttribute(Qt::WA_WState_Created) && child->isVisibleTo(q)) {
  2810             if (set)
  2814             if (set) {
  2811                 [qt_mac_window_for(q) addChildWindow:qt_mac_window_for(child) ordered:NSWindowAbove];
  2815                 NSWindow *childwin = qt_mac_window_for(child);
  2812             else
  2816                 [qt_mac_window_for(q) addChildWindow:childwin ordered:NSWindowAbove];
       
  2817             } else {
  2813                 [qt_mac_window_for(q) removeChildWindow:qt_mac_window_for(child)];
  2818                 [qt_mac_window_for(q) removeChildWindow:qt_mac_window_for(child)];
       
  2819             }
  2814         }
  2820         }
  2815     }
  2821     }
  2816 }
  2822 }
  2817 #endif
  2823 #endif
  2818 
  2824