diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-05-28 02:53:39 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-05-28 02:53:39 (GMT) |
commit | 5f8312f82ac9ef77c89ef363d9c2e0246b398d20 (patch) | |
tree | 80ce3621258cee5358015fce545447164235c00e /src/declarative/graphicsitems/qdeclarativeflickable.cpp | |
parent | 0da1b076bf4e33f239ebe9dc4d8f5363ee24110b (diff) | |
download | Qt-5f8312f82ac9ef77c89ef363d9c2e0246b398d20.zip Qt-5f8312f82ac9ef77c89ef363d9c2e0246b398d20.tar.gz Qt-5f8312f82ac9ef77c89ef363d9c2e0246b398d20.tar.bz2 |
Use QElapsedTimer rather than QTime::elapsed()
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativeflickable.cpp')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativeflickable.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index 1dde510..10dc0f8 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -160,6 +160,7 @@ void QDeclarativeFlickablePrivate::init() q->setFiltersChildEvents(true); QDeclarativeItemPrivate *viewportPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(viewport)); viewportPrivate->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry); + lastPosTime.invalidate(); } /* @@ -656,7 +657,7 @@ void QDeclarativeFlickablePrivate::handleMousePressEvent(QGraphicsSceneMouseEven void QDeclarativeFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent *event) { Q_Q(QDeclarativeFlickable); - if (!interactive || lastPosTime.isNull()) + if (!interactive || !lastPosTime.isValid()) return; bool rejectY = false; bool rejectX = false; @@ -752,7 +753,7 @@ void QDeclarativeFlickablePrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEv stealMouse = false; q->setKeepMouseGrab(false); pressed = false; - if (lastPosTime.isNull()) + if (!lastPosTime.isValid()) return; if (QDeclarativeItemPrivate::elapsed(lastPosTime) > 100) { @@ -780,7 +781,7 @@ void QDeclarativeFlickablePrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEv fixupX(); } - lastPosTime = QTime(); + lastPosTime.invalidate(); if (!timeline.isActive()) q->movementEnding(); @@ -1218,8 +1219,8 @@ bool QDeclarativeFlickable::sendMouseEvent(QGraphicsSceneMouseEvent *event) } return stealThisEvent || d->delayedPressEvent; - } else if (!d->lastPosTime.isNull()) { - d->lastPosTime = QTime(); + } else if (d->lastPosTime.isValid()) { + d->lastPosTime.invalidate(); } if (mouseEvent.type() == QEvent::GraphicsSceneMouseRelease) { d->clearDelayedPress(); |