diff options
author | Morten Sørvig <msorvig@trolltech.com> | 2009-07-27 07:53:47 (GMT) |
---|---|---|
committer | Morten Sørvig <msorvig@trolltech.com> | 2009-07-27 07:53:47 (GMT) |
commit | 8bbe5d242a9534ad29f25f800fcb5b600b3d6750 (patch) | |
tree | 3dd359f1a7bf7ed8e0b719a994e687f272ece2e2 | |
parent | 3bf3981c7026de9017887d08312391b54fe8afc6 (diff) | |
download | Qt-8bbe5d242a9534ad29f25f800fcb5b600b3d6750.zip Qt-8bbe5d242a9534ad29f25f800fcb5b600b3d6750.tar.gz Qt-8bbe5d242a9534ad29f25f800fcb5b600b3d6750.tar.bz2 |
Mac/Cocoa: Remove separator line for "unified document tabs"
Call [NSToolbar setShowsBaselineSeparator] on the (unified) toolbar
if the window contains tabs in document mode.
Task-number: 252660
Reviewed-by: Richard Moe Gustavsen
-rw-r--r-- | src/gui/kernel/qt_cocoa_helpers_mac.mm | 11 | ||||
-rw-r--r-- | src/gui/kernel/qt_cocoa_helpers_mac_p.h | 1 | ||||
-rw-r--r-- | src/gui/widgets/qtabbar.cpp | 10 |
3 files changed, 19 insertions, 3 deletions
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index 3d4164a..1c4177e 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -1069,6 +1069,17 @@ void qt_mac_updateContentBorderMetricts(void * /*OSWindowRef */window, const ::H #endif } +void qt_mac_showBaseLineSeparator(void * /*OSWindowRef */window, bool show) +{ +#if QT_MAC_USE_COCOA + QMacCocoaAutoReleasePool pool; + OSWindowRef theWindow = static_cast<OSWindowRef>(window); + NSToolbar *macToolbar = [theWindow toolbar]; + if (macToolbar) + [macToolbar setShowsBaselineSeparator: show]; +#endif +} + QStringList qt_mac_NSArrayToQStringList(void *nsarray) { QStringList result; diff --git a/src/gui/kernel/qt_cocoa_helpers_mac_p.h b/src/gui/kernel/qt_cocoa_helpers_mac_p.h index 2cc7dee..741edd6 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac_p.h +++ b/src/gui/kernel/qt_cocoa_helpers_mac_p.h @@ -125,6 +125,7 @@ void macWindowSetHasShadow( void * /*OSWindowRef*/ window, bool hasShadow ); void macWindowFlush(void * /*OSWindowRef*/ window); void macSendToolbarChangeEvent(QWidget *widget); void qt_mac_updateContentBorderMetricts(void * /*OSWindowRef */window, const ::HIContentBorderMetrics &metrics); +void qt_mac_showBaseLineSeparator(void * /*OSWindowRef */window, bool show); void * /*NSImage */qt_mac_create_nsimage(const QPixmap &pm); void qt_mac_update_mouseTracking(QWidget *widget); OSStatus qt_mac_drawCGImage(CGContextRef cg, const CGRect *inbounds, CGImageRef); diff --git a/src/gui/widgets/qtabbar.cpp b/src/gui/widgets/qtabbar.cpp index 690e624..6b027b1 100644 --- a/src/gui/widgets/qtabbar.cpp +++ b/src/gui/widgets/qtabbar.cpp @@ -87,13 +87,17 @@ void QTabBarPrivate::updateMacBorderMetrics() // TODO: get metrics to preserve the bottom value // TODO: test tab bar position - // push the black line at the bottom of the menu bar down to the client are so we can paint over it + OSWindowRef window = qt_mac_window_for(q); + + // push base line separator down to the client are so we can paint over it (Carbon) metrics.top = (documentMode && q->isVisible()) ? 1 : 0; metrics.bottom = 0; metrics.left = 0; metrics.right = 0; - - qt_mac_updateContentBorderMetricts(qt_mac_window_for(q), metrics); + qt_mac_updateContentBorderMetricts(window, metrics); + + // hide the base line separator if the tabs have docuemnt mode enabled (Cocoa) + qt_mac_showBaseLineSeparator(window, !documentMode); } #endif } |