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>
This commit is contained in:
Allan Sandfeld Jensen 2016-03-01 11:17:58 +01:00
parent 16e7bcc4cd
commit a7b0cb467c

View File

@ -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)