summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNorwegian Rock Cat <qt-info@nokia.com>2009-04-16 15:15:16 (GMT)
committerNorwegian Rock Cat <qt-info@nokia.com>2009-04-16 15:18:35 (GMT)
commit139265031939d676f049edd2c91918040e0659b4 (patch)
treebd56236f538942f7742939704397b05e0cd119ae
parent6fc56f2da1cb4d15e48ed3458e502eea3fed3903 (diff)
downloadQt-139265031939d676f049edd2c91918040e0659b4.zip
Qt-139265031939d676f049edd2c91918040e0659b4.tar.gz
Qt-139265031939d676f049edd2c91918040e0659b4.tar.bz2
BT:Stop widgets disappearing in unified when clicking the toolbar button
The comment in the code pretty much says it all, so I'll repeat it: This is a workaround for NSToolbar. When a widget is hidden by clicking the toolbar button, Cocoa reparents the widgets to another window (but Qt doesn't know about it). When we start showing them, it reparents back, but at this point it's window is nil, but the window it's being brought into (the Qt one) is for sure created. This stops the hierarchy moving under our feet. Task-number: 251294 Reviewed-by: Prasanth Ullattil
-rw-r--r--src/gui/kernel/qwidget_mac.mm13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index fc34f61..2c3f7f1 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -465,7 +465,18 @@ Q_GUI_EXPORT OSWindowRef qt_mac_window_for(const QWidget *w)
if (hiview){
OSWindowRef window = qt_mac_window_for(hiview);
if (!window && qt_isGenuineQWidget(hiview)) {
- w->window()->d_func()->createWindow_sys();
+ QWidget *myWindow = w->window();
+ // This is a workaround for NSToolbar. When a widget is hidden
+ // by clicking the toolbar button, Cocoa reparents the widgets
+ // to another window (but Qt doesn't know about it).
+ // When we start showing them, it reparents back,
+ // but at this point it's window is nil, but the window it's being brought
+ // into (the Qt one) is for sure created.
+ // This stops the hierarchy moving under our feet.
+ if (myWindow != w && qt_mac_window_for(qt_mac_nativeview_for(myWindow)))
+ return qt_mac_window_for(qt_mac_nativeview_for(myWindow));
+
+ myWindow->d_func()->createWindow_sys();
// Reget the hiview since the "create window could potentially move the view (I guess).
hiview = qt_mac_nativeview_for(w);
window = qt_mac_window_for(hiview);