Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/widgets/qtabbar.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
     
    7474QT_BEGIN_NAMESPACE
    7575
     76
    7677inline static bool verticalTabs(QTabBar::Shape shape)
    7778{
     
    100101        metrics.right = 0;
    101102        qt_mac_updateContentBorderMetricts(window, metrics);
    102        
    103         // hide the base line separator if the tabs have docuemnt mode enabled (Cocoa)
    104         qt_mac_showBaseLineSeparator(window, !documentMode);
     103#if QT_MAC_USE_COCOA
     104        // In Cocoa we need to keep track of the drawRect method.
     105        // If documentMode is enabled we need to change it, unless
     106        // a toolbar is present.
     107        // Notice that all the information is kept in the window,
     108        // that's why we get the private widget for it instead of
     109        // the private widget for this widget.
     110        QWidgetPrivate *privateWidget = qt_widget_private(q->window());
     111        if(privateWidget)
     112            privateWidget->changeMethods = documentMode;
     113        // Since in Cocoa there is no simple way to remove the baseline, so we just ask the
     114        // top level to do the magic for us.
     115        privateWidget->syncUnifiedMode();
     116#endif // QT_MAC_USE_COCOA
    105117    }
    106118#endif
     
    620632}
    621633
    622 void QTabBarPrivate::layoutWidgets(int index)
     634void QTabBarPrivate::layoutWidgets(int )
    623635{
    624636    Q_Q(QTabBar);
    625     int start = 0;
    626     int end = q->count();
    627     if (index != -1) {
    628         start = qMax(index, 0);
    629         end = qMin(end, start + 1);
    630     }
    631     for (int i = start; i < end; ++i) {
     637    for (int i = start; i < q->count(); ++i) {
    632638        layoutTab(i);
    633639    }
     
    12111217        d->makeVisible(index);
    12121218        d->tabList[index].lastTab = oldIndex;
    1213         d->layoutWidgets(oldIndex);
    1214         d->layoutWidgets(index);
     1219        if (oldIndex >= 0 && oldIndex < count())
     1220            d->layoutTab(oldIndex);
     1221        d->layoutTab(index);
     1222#ifndef QT_NO_ACCESSIBILITY
     1223        if (QAccessible::isActive()) {
     1224            QAccessible::updateAccessibility(this, index + 1, QAccessible::Focus);
     1225            QAccessible::updateAccessibility(this, index + 1, QAccessible::Selection);
     1226        }
     1227#endif
    12151228#ifdef QT3_SUPPORT
    12161229        emit selected(index);
     
    19872000    Q_D(QTabBar);
    19882001    if (event->type() == QEvent::StyleChange) {
    1989         d->elideMode = Qt::TextElideMode(style()->styleHint(QStyle::SH_TabBar_ElideMode, 0, this));
     2002        if (!d->elideModeSetByUser)
     2003            d->elideMode = Qt::TextElideMode(style()->styleHint(QStyle::SH_TabBar_ElideMode, 0, this));
    19902004        if (!d->useScrollButtonsSetByUser)
    19912005            d->useScrollButtons = !style()->styleHint(QStyle::SH_TabBar_PreferNoArrows, 0, this);
     
    20202034    Q_D(QTabBar);
    20212035    d->elideMode = mode;
     2036
    20222037    d->refresh();
    20232038}
     
    22362251{
    22372252    Q_D(QTabBar);
     2253
    22382254    d->documentMode = enabled;
    22392255    d->updateMacBorderMetrics();
Note: See TracChangeset for help on using the changeset viewer.