summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2019-06-12 18:17:36 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2019-06-12 16:20:06 +0000
commit6d4a7dd15e57cbcb71c5a118fb9b63bef4df9819 (patch)
tree9db1136047780f9ec31e2a999379d05d1566da4c /src
parentacbc42923786c3cb5a8546fdb34d12fb2f7dea94 (diff)
Convert uses of QTime as a timer to QElapsedTimer
Change-Id: I2504b5a010d33a91676754f9a265725ce39438cb Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/charts/scroller.cpp8
-rw-r--r--src/charts/scroller_p.h4
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;