summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@nokia.com>2010-08-03 08:35:35 (GMT)
committerRichard Moe Gustavsen <richard.gustavsen@nokia.com>2010-08-03 08:38:56 (GMT)
commit44e11692549f1d6a4fed01066a06085dacfaa444 (patch)
tree2096e82429c0bcc406ff13bb16113cb999bef5cb /src/gui
parent1e4a54f0df3d2292d5f0490749ec2fb255912369 (diff)
downloadQt-44e11692549f1d6a4fed01066a06085dacfaa444.zip
Qt-44e11692549f1d6a4fed01066a06085dacfaa444.tar.gz
Qt-44e11692549f1d6a4fed01066a06085dacfaa444.tar.bz2
Cocoa: Active QDockWidget does not stay on top of inactive QDockWidget
If a window has several child windows, it was not be possible to click on a child window to make it stack in front of the other children. The reason is that cocoa held a fixed stacking order of the child windows (sub-windows). This patch will release, and then reestablish, the stacking order of the children upon acitvation. Task-number: QTBUG-11780 Reviewed-by: prasanth
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qapplication.cpp7
-rw-r--r--src/gui/kernel/qt_cocoa_helpers_mac.mm16
-rw-r--r--src/gui/kernel/qt_cocoa_helpers_mac_p.h1
3 files changed, 24 insertions, 0 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 5c333b0..3303800 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -2540,6 +2540,13 @@ void QApplication::setActiveWindow(QWidget* act)
sendSpontaneousEvent(w, &activationChange);
}
+#ifdef QT_MAC_USE_COCOA
+ // In case the user clicked on a child window, we need to
+ // reestablish the stacking order of the window so
+ // it pops in front of other child windows in cocoa:
+ qt_cocoaStackChildWindowOnTopOfOtherChildren(window);
+#endif
+
for(int i = 0; i < toBeDeactivated.size(); ++i) {
QWidget *w = toBeDeactivated.at(i);
sendSpontaneousEvent(w, &windowDeactivate);
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm
index 3fc27f4..647cb86 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac.mm
+++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm
@@ -1527,6 +1527,22 @@ void macSyncDrawingOnFirstInvocation(void * /*OSWindowRef */window)
[theWindow display];
}
}
+
+void qt_cocoaStackChildWindowOnTopOfOtherChildren(QWidget *childWidget)
+{
+ if (!childWidget)
+ return;
+
+ QWidget *parent = childWidget->parentWidget();
+ if (childWidget->isWindow() && parent) {
+ if ([[qt_mac_window_for(parent) childWindows] containsObject:qt_mac_window_for(childWidget)]) {
+ QWidgetPrivate *d = qt_widget_private(childWidget);
+ d->setSubWindowStacking(false);
+ d->setSubWindowStacking(true);
+ }
+ }
+}
+
#endif // QT_MAC_USE_COCOA
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac_p.h b/src/gui/kernel/qt_cocoa_helpers_mac_p.h
index 44fb4f0..c6c2db2 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac_p.h
+++ b/src/gui/kernel/qt_cocoa_helpers_mac_p.h
@@ -148,6 +148,7 @@ void qt_cocoaChangeOverrideCursor(const QCursor &cursor);
// These methods exists only for supporting unified mode.
void macDrawRectOnTop(void * /*OSWindowRef */ window);
void macSyncDrawingOnFirstInvocation(void * /*OSWindowRef */window);
+void qt_cocoaStackChildWindowOnTopOfOtherChildren(QWidget *widget);
#endif
void qt_mac_menu_collapseSeparators(void * /*NSMenu */ menu, bool collapse);
bool qt_dispatchKeyEvent(void * /*NSEvent * */ keyEvent, QWidget *widgetToGetEvent);