diff -r b72c6db6890b -r 5dc02b23752f src/gui/widgets/qtabbar.cpp --- a/src/gui/widgets/qtabbar.cpp Wed Jun 23 19:07:03 2010 +0300 +++ b/src/gui/widgets/qtabbar.cpp Tue Jul 06 15:10:48 2010 +0300 @@ -73,6 +73,7 @@ QT_BEGIN_NAMESPACE + inline static bool verticalTabs(QTabBar::Shape shape) { return shape == QTabBar::RoundedWest @@ -99,9 +100,20 @@ 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 } @@ -619,16 +631,10 @@ } } -void QTabBarPrivate::layoutWidgets(int index) +void QTabBarPrivate::layoutWidgets(int start) { Q_Q(QTabBar); - int start = 0; - int end = q->count(); - if (index != -1) { - start = qMax(index, 0); - end = qMin(end, start + 1); - } - for (int i = start; i < end; ++i) { + for (int i = start; i < q->count(); ++i) { layoutTab(i); } } @@ -1210,8 +1216,9 @@ update(); d->makeVisible(index); d->tabList[index].lastTab = oldIndex; - d->layoutWidgets(oldIndex); - d->layoutWidgets(index); + if (oldIndex >= 0 && oldIndex < count()) + d->layoutTab(oldIndex); + d->layoutTab(index); #ifdef QT3_SUPPORT emit selected(index); #endif @@ -1986,7 +1993,8 @@ { Q_D(QTabBar); if (event->type() == QEvent::StyleChange) { - d->elideMode = Qt::TextElideMode(style()->styleHint(QStyle::SH_TabBar_ElideMode, 0, this)); + if (!d->elideModeSetByUser) + d->elideMode = Qt::TextElideMode(style()->styleHint(QStyle::SH_TabBar_ElideMode, 0, this)); if (!d->useScrollButtonsSetByUser) d->useScrollButtons = !style()->styleHint(QStyle::SH_TabBar_PreferNoArrows, 0, this); d->refresh(); @@ -2019,6 +2027,7 @@ { Q_D(QTabBar); d->elideMode = mode; + d->elideModeSetByUser = true; d->refresh(); } @@ -2235,6 +2244,7 @@ void QTabBar::setDocumentMode(bool enabled) { Q_D(QTabBar); + d->documentMode = enabled; d->updateMacBorderMetrics(); }