QScrollBar::initStyleOption(): fix QStyle::State_On handling

QWindowsStyle considers QStyle::State_On as pressed, whereas
QMacStyle uses the same state for transient scrollbars. Thus,
to indicate transient scrollbars, QScrollBar::initStyleOption()
must set QStyle::State_On only when the current style actually
supports transient scrollbars.

Task-number: QTBUG-28523
Change-Id: I94d207b1e8c5c4bd6f4b99e8b4f1661197fbe9dd
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
This commit is contained in:
J-P Nurmi 2012-12-10 14:31:50 +01:00 committed by The Qt Project
parent cf728e60a7
commit a31dd2e995

View File

@ -325,7 +325,7 @@ void QScrollBar::initStyleOption(QStyleOptionSlider *option) const
option->upsideDown = d->invertedAppearance;
if (d->orientation == Qt::Horizontal)
option->state |= QStyle::State_Horizontal;
if (d->flashed || !d->transient)
if ((d->flashed || !d->transient) && style()->styleHint(QStyle::SH_ScrollBar_Transient))
option->state |= QStyle::State_On;
}