summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qwidget_mac.mm
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-04-08 16:06:51 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-04-08 16:06:51 (GMT)
commitf6f2d03b2d74b236d33a5ca32a49f138bf521c13 (patch)
treef81b90ddc4f2b34bf0e9a56bbebbebb1dac9cc7d /src/gui/kernel/qwidget_mac.mm
parent7c8980ee041e874a6c430f01b2daff4955517b03 (diff)
parent75fd46451cabd680d16913d5dfd4733c09db3459 (diff)
downloadQt-f6f2d03b2d74b236d33a5ca32a49f138bf521c13.zip
Qt-f6f2d03b2d74b236d33a5ca32a49f138bf521c13.tar.gz
Qt-f6f2d03b2d74b236d33a5ca32a49f138bf521c13.tar.bz2
Merge branch 4.7 into qt-master-from-4.7
Diffstat (limited to 'src/gui/kernel/qwidget_mac.mm')
-rw-r--r--src/gui/kernel/qwidget_mac.mm35
1 files changed, 20 insertions, 15 deletions
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index 4c205c8..f5a9e27 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -2849,14 +2849,16 @@ void QWidgetPrivate::transferChildren()
#ifdef QT_MAC_USE_COCOA
void QWidgetPrivate::setSubWindowStacking(bool set)
{
+ // After hitting too many unforeseen bugs trying to put Qt on top of the cocoa child
+ // window API, we have decided to revert this behaviour as much as we can. We
+ // therefore now only allow child windows to exist for children of modal dialogs.
+ static bool use_behaviour_qt473 = !qgetenv("QT_MAC_USE_CHILDWINDOWS").isEmpty();
+
// This will set/remove a visual relationship between parent and child on screen.
// The reason for doing this is to ensure that a child always stacks infront of
- // its parent (expecially if both windows are modal, and the child blocks input to
- // the parent while at the same time hiding behind it). Unfortunatly is turns out
- // that [NSWindow addChildWindow] has
+ // its parent. Unfortunatly is turns out that [NSWindow addChildWindow] has
// several unwanted side-effects, one of them being the moving of a child when
- // moving the parent, which we choose to accept (if this is unacceptable, consider
- // using Qt::WA_MacNoCocoaChildWindow). A way tougher side-effect is
+ // moving the parent, which we choose to accept. A way tougher side-effect is
// that Cocoa will hide the parent if you hide the child. And in the case of
// 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
@@ -2879,14 +2881,15 @@ void QWidgetPrivate::setSubWindowStacking(bool set)
if (QWidget *parent = q->parentWidget()) {
if (NSWindow *pwin = [qt_mac_nativeview_for(parent) window]) {
if (set) {
- if (!q->testAttribute(Qt::WA_MacNoCocoaChildWindow)) {
- Qt::WindowType ptype = parent->window()->windowType();
- if ([pwin isVisible] && (ptype == Qt::Window || ptype == Qt::Dialog) && ![qwin parentWindow]) {
- NSInteger level = [qwin level];
- [pwin addChildWindow:qwin ordered:NSWindowAbove];
- if ([qwin level] < level)
- [qwin setLevel:level];
- }
+ Qt::WindowType ptype = parent->window()->windowType();
+ if ([pwin isVisible]
+ && (ptype == Qt::Window || ptype == Qt::Dialog)
+ && ![qwin parentWindow]
+ && (!use_behaviour_qt473 && parent->windowModality() == Qt::ApplicationModal)) {
+ NSInteger level = [qwin level];
+ [pwin addChildWindow:qwin ordered:NSWindowAbove];
+ if ([qwin level] < level)
+ [qwin setLevel:level];
}
} else {
[pwin removeChildWindow:qwin];
@@ -2894,14 +2897,16 @@ void QWidgetPrivate::setSubWindowStacking(bool set)
}
}
+ // Only set-up child windows for q if q is modal:
+ if (set && !use_behaviour_qt473 && q->windowModality() != Qt::ApplicationModal)
+ return;
+
QObjectList widgets = q->children();
for (int i=0; i<widgets.size(); ++i) {
QWidget *child = qobject_cast<QWidget *>(widgets.at(i));
if (child && child->isWindow()) {
if (NSWindow *cwin = [qt_mac_nativeview_for(child) window]) {
if (set) {
- if (child->testAttribute(Qt::WA_MacNoCocoaChildWindow))
- continue;
Qt::WindowType ctype = child->window()->windowType();
if ([cwin isVisible] && (ctype == Qt::Window || ctype == Qt::Dialog) && ![cwin parentWindow]) {
NSInteger level = [cwin level];