diff options
author | Norwegian Rock Cat <qt-info@nokia.com> | 2009-04-16 15:15:16 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2009-04-17 02:31:06 (GMT) |
commit | 6574991f7b17f1d627e67fc5de1eed09b5c2e095 (patch) | |
tree | 4970407b481bef535ad3fa1e568cb75b3d522287 | |
parent | 78815e49fa25b40e437c125d73c11fb72aacd90f (diff) | |
download | Qt-6574991f7b17f1d627e67fc5de1eed09b5c2e095.zip Qt-6574991f7b17f1d627e67fc5de1eed09b5c2e095.tar.gz Qt-6574991f7b17f1d627e67fc5de1eed09b5c2e095.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
(cherry picked from commit 139265031939d676f049edd2c91918040e0659b4)
-rw-r--r-- | src/gui/kernel/qwidget_mac.mm | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index aa1f736..43f6725 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); |