fixed rounding issue that caused an infinite loop

This commit is contained in:
2017-12-27 23:18:42 +01:00
parent 9bbacdfae4
commit 2cdc404eb4

View file

@ -6,6 +6,7 @@
#include <QMouseEvent>
#include <QPainter>
#include <QTimer>
#include <cmath>
#define MIN_THUMB_HEIGHT 10
@ -208,13 +209,13 @@ void ScrollBar::setCurrentValue(qreal value)
value = std::max(this->minimum, std::min(this->maximum - this->largeChange,
value + this->smoothScrollingOffset));
if (this->currentValue != value) {
if (std::abs(this->currentValue - value) > 0.000001) {
this->currentValue = value;
updateScroll();
this->updateScroll();
this->currentValueChanged();
update();
this->update();
}
}