diff options
-rw-r--r-- | src/charts/scroller.cpp | 8 | ||||
-rw-r--r-- | src/charts/scroller_p.h | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/charts/scroller.cpp b/src/charts/scroller.cpp index 09809973..57a257c8 100644 --- a/src/charts/scroller.cpp +++ b/src/charts/scroller.cpp @@ -52,11 +52,11 @@ void Scroller::move(const QPointF &delta) { switch (m_state) { case Pressed: - m_timeStamp = QTime::currentTime(); + m_timeStamp.restart(); break; case Scroll: stopTicker(); - m_timeStamp = QTime::currentTime(); + m_timeStamp.restart(); break; default: break; @@ -69,10 +69,10 @@ void Scroller::scrollTo(const QPointF &delta) // Starts scrolling, if at least m_timeTresholdMin msecs has gone since timestamp // current time is no more than m_timeTresholdMax from timestamp - if ((m_timeStamp.elapsed() > m_timeTresholdMin) && (m_timeStamp.msecsTo(QTime::currentTime()) < m_timeTresholdMax)) { + if ((m_timeStamp.elapsed() > m_timeTresholdMin) && (m_timeStamp.elapsed() < m_timeTresholdMax)) { // Release was quick enough. Start scrolling. qreal interval = 25; - qreal time = m_timeStamp.msecsTo(QTime::currentTime()); + qreal time = m_timeStamp.elapsed(); if (qFuzzyCompare(time, 0)) { m_speed = delta / 5; } else { diff --git a/src/charts/scroller_p.h b/src/charts/scroller_p.h index 7cc7a4f6..1b7a8f69 100644 --- a/src/charts/scroller_p.h +++ b/src/charts/scroller_p.h @@ -42,7 +42,7 @@ #include <QtCharts/QChartGlobal> #include <QtCore/QObject> #include <QtCore/QBasicTimer> -#include <QtCore/QTime> +#include <QtCore/QElapsedTimer> #include <QtCore/QPointF> #include <QtCharts/private/qchartglobal_p.h> @@ -105,7 +105,7 @@ private: private: ScrollTicker m_ticker; - QTime m_timeStamp; + QElapsedTimer m_timeStamp; QPointF m_speed; QPointF m_fraction; int m_timeTresholdMin; |