From 9820412d2551b655fec24ffde7b2a56e3ad168ea Mon Sep 17 00:00:00 2001 From: Norwegian Rock Cat Date: Wed, 13 May 2009 15:34:34 +0200 Subject: Ensure that sheets are hidden if the parents are hidden in Carbon. Seems to work correctly in Cocoa, but we need to handle this special case in Carbon ourselves. Task-number: 253324 Reviewed-by: Richard Moe Gustavsen --- src/gui/kernel/qwidget_mac.mm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 6d3da61..6524bc9 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -728,6 +728,7 @@ static OSWindowRef qt_mac_create_window(QWidget *, WindowClass wclass, WindowAtt static EventTypeSpec window_events[] = { { kEventClassWindow, kEventWindowClose }, { kEventClassWindow, kEventWindowExpanded }, + { kEventClassWindow, kEventWindowHidden }, { kEventClassWindow, kEventWindowZoomed }, { kEventClassWindow, kEventWindowCollapsed }, { kEventClassWindow, kEventWindowToolbarSwitchMode }, @@ -997,6 +998,19 @@ OSStatus QWidgetPrivate::qt_window_event(EventHandlerCallRef er, EventRef event, } } } + } else if (ekind == kEventWindowHidden) { + // Make sure that we also hide any visible sheets on our window. + // Cocoa does the right thing for us. + const QObjectList children = widget->children(); + const int childCount = children.count(); + for (int i = 0; i < childCount; ++i) { + QObject *obj = children.at(i); + if (obj->isWidgetType()) { + QWidget *widget = static_cast(obj); + if (qt_mac_is_macsheet(widget) && widget->isVisible()) + widget->hide(); + } + } } else { handled_event = false; } -- cgit v0.12