diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-11-20 10:16:31 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-11-20 10:37:45 (GMT) |
commit | 8fb9ed08c60b667737a9ae1b209da61fe9c67200 (patch) | |
tree | 31107a87808a53ff9abd779b20c6b4d0f090d116 /src/gui/widgets | |
parent | d9fa92933ff6ff1afad342f7f94e37f810cf8176 (diff) | |
download | Qt-8fb9ed08c60b667737a9ae1b209da61fe9c67200.zip Qt-8fb9ed08c60b667737a9ae1b209da61fe9c67200.tar.gz Qt-8fb9ed08c60b667737a9ae1b209da61fe9c67200.tar.bz2 |
Fix for tabwidget usesScrollButton being overriden by stylesheet
Setting a stylesheet or reparenting a widget into a
widget using style sheet would cause the usesScrollButtons
to be reset. Instead we now keep the flag whenever
it has been explicitly set by the user rather than
querying from the style again.
Task-number: QTBUG-3370
Reviewed-by: jbache
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/qtabbar.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/qtabbar_p.h | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/gui/widgets/qtabbar.cpp b/src/gui/widgets/qtabbar.cpp index 3935c55..8ef6017 100644 --- a/src/gui/widgets/qtabbar.cpp +++ b/src/gui/widgets/qtabbar.cpp @@ -1948,7 +1948,8 @@ void QTabBar::changeEvent(QEvent *event) Q_D(QTabBar); if (event->type() == QEvent::StyleChange) { d->elideMode = Qt::TextElideMode(style()->styleHint(QStyle::SH_TabBar_ElideMode, 0, this)); - d->useScrollButtons = !style()->styleHint(QStyle::SH_TabBar_PreferNoArrows, 0, this); + if (!d->useScrollButtonsSetByUser) + d->useScrollButtons = !style()->styleHint(QStyle::SH_TabBar_PreferNoArrows, 0, this); d->refresh(); } else if (event->type() == QEvent::FontChange) { d->refresh(); @@ -2003,6 +2004,7 @@ bool QTabBar::usesScrollButtons() const void QTabBar::setUsesScrollButtons(bool useButtons) { Q_D(QTabBar); + d->useScrollButtonsSetByUser = true; if (d->useScrollButtons == useButtons) return; d->useScrollButtons = useButtons; diff --git a/src/gui/widgets/qtabbar_p.h b/src/gui/widgets/qtabbar_p.h index 9f3285b..2e8fb6d 100644 --- a/src/gui/widgets/qtabbar_p.h +++ b/src/gui/widgets/qtabbar_p.h @@ -75,7 +75,7 @@ class QTabBarPrivate : public QWidgetPrivate public: QTabBarPrivate() :currentIndex(-1), pressedIndex(-1), shape(QTabBar::RoundedNorth), layoutDirty(false), - drawBase(true), scrollOffset(0), expanding(true), closeButtonOnTabs(false), + drawBase(true), scrollOffset(0), useScrollButtonsSetByUser(false) , expanding(true), closeButtonOnTabs(false), selectionBehaviorOnRemove(QTabBar::SelectRightTab), paintWithOffsets(true), movable(false), dragInProgress(false), documentMode(false), movingTab(0) #ifdef Q_WS_MAC @@ -187,6 +187,7 @@ public: QSize iconSize; Qt::TextElideMode elideMode; bool useScrollButtons; + bool useScrollButtonsSetByUser; bool expanding; bool closeButtonOnTabs; |