diff options
author | Carlos Manuel Duclos Vergara <carlos.duclos@nokia.com> | 2010-04-27 11:26:42 (GMT) |
---|---|---|
committer | Carlos Manuel Duclos Vergara <carlos.duclos@nokia.com> | 2010-04-27 11:30:51 (GMT) |
commit | 4580c2e9c2bbcb911f9e1cecd4551054598d256d (patch) | |
tree | b38eb05baac4864e309921b843b8246ffd4ab087 /src/gui/widgets | |
parent | 9cea45515ef283c9a870c6f515da50d31addafcf (diff) | |
download | Qt-4580c2e9c2bbcb911f9e1cecd4551054598d256d.zip Qt-4580c2e9c2bbcb911f9e1cecd4551054598d256d.tar.gz Qt-4580c2e9c2bbcb911f9e1cecd4551054598d256d.tar.bz2 |
QTabWidget documentMode not working correctly on Mac
This feature was implemented in Carbon and was never ported to Cocoa.
The major problem is the fact that Cocoa draws a line under the titlebar,
regardless of what we say. The only way to avoid drawing that line is
by adding a native toolbar and ask it not to draw its baseline. If there
is not toolbar, as it happens in this case, there is no way to prevent
that line from being drawn. So instead we paint over that line and hope
for the best.
Task-number: QTBUG-8159
Reviewed-by: Richard Moe Gustavsen
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/qtabbar.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/gui/widgets/qtabbar.cpp b/src/gui/widgets/qtabbar.cpp index d03a2f4..8aaaade 100644 --- a/src/gui/widgets/qtabbar.cpp +++ b/src/gui/widgets/qtabbar.cpp @@ -69,6 +69,7 @@ QT_BEGIN_NAMESPACE + inline static bool verticalTabs(QTabBar::Shape shape) { return shape == QTabBar::RoundedWest @@ -95,9 +96,20 @@ void QTabBarPrivate::updateMacBorderMetrics() metrics.left = 0; metrics.right = 0; qt_mac_updateContentBorderMetricts(window, metrics); - - // hide the base line separator if the tabs have docuemnt mode enabled (Cocoa) - qt_mac_showBaseLineSeparator(window, !documentMode); +#if QT_MAC_USE_COCOA + // In Cocoa we need to keep track of the drawRect method. + // If documentMode is enabled we need to change it, unless + // a toolbar is present. + // Notice that all the information is kept in the window, + // that's why we get the private widget for it instead of + // the private widget for this widget. + QWidgetPrivate *privateWidget = qt_widget_private(q->window()); + if(privateWidget) + privateWidget->changeMethods = documentMode; + // Since in Cocoa there is no simple way to remove the baseline, so we just ask the + // top level to do the magic for us. + privateWidget->syncUnifiedMode(); +#endif // QT_MAC_USE_COCOA } #endif } @@ -2193,6 +2205,7 @@ bool QTabBar::documentMode() const void QTabBar::setDocumentMode(bool enabled) { Q_D(QTabBar); + d->documentMode = enabled; d->updateMacBorderMetrics(); } |