From ce84a1bde3a1af536ebb95d2f6dd947fee248279 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sat, 10 Jan 2015 20:01:38 +0100 Subject: [PATCH] Reduce excessive painting caused by transient scrollbars The step logic in scrollByDelta() made scrollbar position to go temporarily outside its min/max boundaries, and then setValue() corrected it immediately back within its bounds. The false change notifications caused by this position vs. value ping pong caused plenty of unnecessary updates. Task-number: QTBUG-30316 Change-Id: I32dd5bdb7b0c578dfc5dfa1deecceb19bb98a2b3 Reviewed-by: Gabriel de Dietrich --- src/widgets/widgets/qabstractslider.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/widgets/qabstractslider.cpp b/src/widgets/widgets/qabstractslider.cpp index d9dae9d7755..fccdd24c398 100644 --- a/src/widgets/widgets/qabstractslider.cpp +++ b/src/widgets/widgets/qabstractslider.cpp @@ -728,7 +728,7 @@ bool QAbstractSliderPrivate::scrollByDelta(Qt::Orientation orientation, Qt::Keyb stepsToScroll = -stepsToScroll; int prevValue = value; - position = overflowSafeAdd(stepsToScroll); // value will be updated by triggerAction() + position = bound(overflowSafeAdd(stepsToScroll)); // value will be updated by triggerAction() q->triggerAction(QAbstractSlider::SliderMove); if (prevValue == value) {