diff options
author | Prasanth Ullattil <prasanth.ullattil@nokia.com> | 2010-07-28 08:13:33 (GMT) |
---|---|---|
committer | Prasanth Ullattil <prasanth.ullattil@nokia.com> | 2010-07-28 12:41:07 (GMT) |
commit | 68c091c29eb8204a2959858e305b26b850801250 (patch) | |
tree | 6362bfdda1cd97f5041e35ac169954ccc3c37cc6 /src/gui/widgets | |
parent | d1024fa94a9358b4f6839c8321c49ca6343e7bd2 (diff) | |
download | Qt-68c091c29eb8204a2959858e305b26b850801250.zip Qt-68c091c29eb8204a2959858e305b26b850801250.tar.gz Qt-68c091c29eb8204a2959858e305b26b850801250.tar.bz2 |
Wrong geometery for QMainWindow with Unified toolbar on Cocoa.
If a mainwindow is shown maximized (initially) with unified toolbar,
the top portion of the widget gets hidden underneath the native toolbar.
This is because while showing the window, the toolbar is resized. Which
causes the client area of the NSWindow to resize, we need to update the
frame of the NSView for QMainWindow based on this new size.
Task-number: QTBUG-10500
Reviewed-by: Denis
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/qmainwindowlayout_mac.mm | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gui/widgets/qmainwindowlayout_mac.mm b/src/gui/widgets/qmainwindowlayout_mac.mm index b8cef93..1bfc746 100644 --- a/src/gui/widgets/qmainwindowlayout_mac.mm +++ b/src/gui/widgets/qmainwindowlayout_mac.mm @@ -48,6 +48,7 @@ #include <Carbon/Carbon.h> #else #include <private/qcocoatoolbardelegate_mac_p.h> +#import <private/qcocoawindowdelegate_mac_p.h> #endif QT_BEGIN_NAMESPACE @@ -337,6 +338,17 @@ void QMainWindowLayout::updateHIToolBarStatus() #endif layoutState.mainWindow->setUpdatesEnabled(false); // reduces a little bit of flicker, not all though +#if defined(QT_MAC_USE_COCOA) + QMacCocoaAutoReleasePool pool; + NSView *cView = [qt_mac_window_for(layoutState.mainWindow) contentView]; + if (useMacToolbar) { + [cView setPostsFrameChangedNotifications:YES]; + [[NSNotificationCenter defaultCenter] addObserver: [QT_MANGLE_NAMESPACE(QCocoaWindowDelegate) sharedDelegate] + selector: @selector(syncContentViewFrame:) + name: NSViewFrameDidChangeNotification + object: cView]; + } +#endif if (!useMacToolbar) { macWindowToolbarShow(layoutState.mainWindow, false); // Move everything out of the HIToolbar into the main toolbar. @@ -356,6 +368,14 @@ void QMainWindowLayout::updateHIToolBarStatus() } syncUnifiedToolbarVisibility(); } +#if defined(QT_MAC_USE_COCOA) + if (!useMacToolbar) { + [cView setPostsFrameChangedNotifications:NO]; + [[NSNotificationCenter defaultCenter] removeObserver: [QT_MANGLE_NAMESPACE(QCocoaWindowDelegate) sharedDelegate] + name: NSViewFrameDidChangeNotification + object: cView]; + } +#endif layoutState.mainWindow->setUpdatesEnabled(true); } |