diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-04-02 12:17:20 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-04-02 12:17:20 +0300 |
commit | 35278ed7f80ed8a02785573d510c36b38998debe (patch) | |
tree | cb8a4358d39e90615d8dc9cb870393588e4edeb9 | |
parent | 8e182c09072b75d05c1dff89bd3337f08782a562 (diff) | |
download | mv-35278ed7f80ed8a02785573d510c36b38998debe.tar.gz mv-35278ed7f80ed8a02785573d510c36b38998debe.tar.bz2 mv-35278ed7f80ed8a02785573d510c36b38998debe.tar.xz mv-35278ed7f80ed8a02785573d510c36b38998debe.zip |
Using minimal step in setting slider values.
-rw-r--r-- | src/gui/widgets/slider.cpp | 16 |
1 files changed, 5 insertions, 11 deletions
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<int>((mValue - mScaleStart) / mStepLength) + * mStepLength + mScaleStart; } double Slider::markerPositionToValue(const int v) const |