From 35278ed7f80ed8a02785573d510c36b38998debe Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 2 Apr 2014 12:17:20 +0300 Subject: Using minimal step in setting slider values. --- src/gui/widgets/slider.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'src/gui/widgets') diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp index e440631ad..66265a919 100644 --- a/src/gui/widgets/slider.cpp +++ b/src/gui/widgets/slider.cpp @@ -368,7 +368,6 @@ void Slider::mousePressed(MouseEvent &event) setValue(markerPositionToValue(x - mMarkerLength / 2)); else setValue(markerPositionToValue(height - y - mMarkerLength / 2)); - distributeActionEvent(); } } @@ -450,18 +449,13 @@ void Slider::setValue(const double value) { mRedraw = true; if (value > mScaleEnd) - { mValue = mScaleEnd; - return; - } - - if (value < mScaleStart) - { + else if (value < mScaleStart) mValue = mScaleStart; - return; - } - - mValue = value; + else + mValue = value; + mValue = static_cast((mValue - mScaleStart) / mStepLength) + * mStepLength + mScaleStart; } double Slider::markerPositionToValue(const int v) const -- cgit v1.2.3-70-g09d2