From 7deb67707f32bbbc2ab46e9f8d46b88a981668e4 Mon Sep 17 00:00:00 2001 From: kleuter Date: Wed, 24 Nov 2021 12:14:36 +0100 Subject: [PATCH] 5.15.2: fix for QTBUG-98093 (backport of QSlider: Always set the sunken state and the active control, https://github.com/qt/qtbase/commit/c7e8133a95220e0ce96171024e34de8c53975b9c) --- 5.15.2/qtbase/src/widgets/widgets/qslider.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/5.15.2/qtbase/src/widgets/widgets/qslider.cpp b/5.15.2/qtbase/src/widgets/widgets/qslider.cpp index 161e4ba..9b94fb5 100644 --- a/5.15.2/qtbase/src/widgets/widgets/qslider.cpp +++ b/5.15.2/qtbase/src/widgets/widgets/qslider.cpp @@ -153,6 +153,13 @@ void QSlider::initStyleOption(QStyleOptionSlider *option) const option->pageStep = d->pageStep; if (d->orientation == Qt::Horizontal) option->state |= QStyle::State_Horizontal; + + if (d->pressedControl) { + option->activeSubControls = d->pressedControl; + option->state |= QStyle::State_Sunken; + } else { + option->activeSubControls = d->hoverControl; + } } bool QSliderPrivate::updateHoverControl(const QPoint &pos) @@ -315,12 +322,6 @@ void QSlider::paintEvent(QPaintEvent *) opt.subControls = QStyle::SC_SliderGroove | QStyle::SC_SliderHandle; if (d->tickPosition != NoTicks) opt.subControls |= QStyle::SC_SliderTickmarks; - if (d->pressedControl) { - opt.activeSubControls = d->pressedControl; - opt.state |= QStyle::State_Sunken; - } else { - opt.activeSubControls = d->hoverControl; - } style()->drawComplexControl(QStyle::CC_Slider, &opt, &p, this); }