summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-03-01 11:17:58 +0100
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-04-05 07:50:53 +0000
commita7b0cb467ca5c4a9447d049910c9e3f0abc5897c (patch)
tree258c269a438b23ce640b7d5656299999422aacb5
parent16e7bcc4cddf31bb2d13d5c6dfbe9184b66d5b06 (diff)
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 <simon.hausmann@theqtcompany.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
-rw-r--r--src/widgets/widgets/qabstractslider.cpp10
1 files changed, 9 insertions, 1 deletions
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)