From a7b0cb467ca5c4a9447d049910c9e3f0abc5897c Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 1 Mar 2016 11:17:58 +0100 Subject: Accept partial line scrolls QAbstractSlider might register and use small scroll events that would scroll less than a single line. Since we consume the scroll-event we should accept it, so it doesn't scroll other widgets too. Task-number: QTBUG-49549 Change-Id: I7c64c5f6cae46f02ba21058abbecb791fc3c88eb Reviewed-by: Simon Hausmann Reviewed-by: Shawn Rutledge --- src/widgets/widgets/qabstractslider.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/widgets/qabstractslider.cpp b/src/widgets/widgets/qabstractslider.cpp index 283cac80da..92d2ffde2b 100644 --- a/src/widgets/widgets/qabstractslider.cpp +++ b/src/widgets/widgets/qabstractslider.cpp @@ -720,8 +720,16 @@ bool QAbstractSliderPrivate::scrollByDelta(Qt::Orientation orientation, Qt::Keyb stepsToScroll = int(offset_accumulated); #endif offset_accumulated -= int(offset_accumulated); - if (stepsToScroll == 0) + if (stepsToScroll == 0) { + // We moved less than a line, but might still have accumulated partial scroll, + // unless we already are at one of the ends. + if (offset_accumulated > 0.f && value < maximum) + return true; + if (offset_accumulated < 0.f && value > minimum) + return true; + offset_accumulated = 0; return false; + } } if (invertedControls) -- cgit v1.2.3