summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qstandardgestures.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2010-02-18 19:00:36 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2010-03-17 10:54:17 (GMT)
commit0f771c62f5253a969f5a8a81bfd9254b9bd58b8f (patch)
tree1f5dcfcfc84fd74f7017710478dadacc18de822c /src/gui/kernel/qstandardgestures.cpp
parentec5b7ea367389234697a98d7243243ec689be724 (diff)
downloadQt-0f771c62f5253a969f5a8a81bfd9254b9bd58b8f.zip
Qt-0f771c62f5253a969f5a8a81bfd9254b9bd58b8f.tar.gz
Qt-0f771c62f5253a969f5a8a81bfd9254b9bd58b8f.tar.bz2
Port QtGui uses of QTime as a stopwatch to QTimestamp
Diffstat (limited to 'src/gui/kernel/qstandardgestures.cpp')
-rw-r--r--src/gui/kernel/qstandardgestures.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp
index 86bf1b2e..a575717 100644
--- a/src/gui/kernel/qstandardgestures.cpp
+++ b/src/gui/kernel/qstandardgestures.cpp
@@ -301,7 +301,7 @@ QGestureRecognizer::Result QSwipeGestureRecognizer::recognize(QGesture *state,
switch (event->type()) {
case QEvent::TouchBegin: {
d->speed = 1;
- d->time = QTime::currentTime();
+ d->time.start();
d->started = true;
result = QGestureRecognizer::MayBeGesture;
break;
@@ -338,11 +338,10 @@ QGestureRecognizer::Result QSwipeGestureRecognizer::recognize(QGesture *state,
p3.screenPos().y() - d->lastPositions[2].y()) / 3;
const int distance = xDistance >= yDistance ? xDistance : yDistance;
- int elapsedTime = d->time.msecsTo(QTime::currentTime());
+ int elapsedTime = d->time.restart();
if (!elapsedTime)
elapsedTime = 1;
d->speed = 0.9 * d->speed + distance / elapsedTime;
- d->time = QTime::currentTime();
d->swipeAngle = QLineF(p1.startScreenPos(), p1.screenPos()).angle();
static const int MoveThreshold = 50;
@@ -405,7 +404,7 @@ void QSwipeGestureRecognizer::reset(QGesture *state)
d->lastPositions[0] = d->lastPositions[1] = d->lastPositions[2] = QPoint();
d->started = false;
d->speed = 0;
- d->time = QTime();
+ d->time.invalidate();
QGestureRecognizer::reset(state);
}