diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2017-04-24 22:04:58 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2017-04-25 13:27:06 +0000 |
commit | a5eee7695ff09338d1481efde268ccdc62cd9143 (patch) | |
tree | c0cbe3cb6147f57d2d9332c5fa82dfcd65446ec2 /src/quicktemplates2 | |
parent | 381a2cf4a5a65f446b41240e8a6e6a6356988cb2 (diff) |
Pass timestamp to QQuickPopupPrivate::handlePress/Move/Release()
QQuickDrawer needs the timestamp to calculate velocity.
Change-Id: I1ab5fc2e492948a424a8c56e4b9788fc3d489333
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2')
-rw-r--r-- | src/quicktemplates2/qquickdrawer.cpp | 6 | ||||
-rw-r--r-- | src/quicktemplates2/qquickpopup.cpp | 25 | ||||
-rw-r--r-- | src/quicktemplates2/qquickpopup_p_p.h | 6 |
3 files changed, 20 insertions, 17 deletions
diff --git a/src/quicktemplates2/qquickdrawer.cpp b/src/quicktemplates2/qquickdrawer.cpp index d8397e92..862b36dc 100644 --- a/src/quicktemplates2/qquickdrawer.cpp +++ b/src/quicktemplates2/qquickdrawer.cpp @@ -395,7 +395,7 @@ bool QQuickDrawerPrivate::ungrabMouse(QMouseEvent *event) bool QQuickDrawerPrivate::handleMousePressEvent(QQuickItem *item, QMouseEvent *event) { - handlePress(item->mapToScene(event->localPos())); + handlePress(item->mapToScene(event->localPos()), event->timestamp()); offset = 0; pressPoint = event->windowPos(); @@ -412,7 +412,7 @@ bool QQuickDrawerPrivate::handleMousePressEvent(QQuickItem *item, QMouseEvent *e bool QQuickDrawerPrivate::handleMouseMoveEvent(QQuickItem *item, QMouseEvent *event) { Q_Q(QQuickDrawer); - handleMove(item->mapToScene(event->localPos())); + handleMove(item->mapToScene(event->localPos()), event->timestamp()); // Don't react to synthesized mouse move events at INF,INF coordinates. // QQuickWindowPrivate::translateTouchToMouse() uses them to clear hover @@ -450,7 +450,7 @@ bool QQuickDrawerPrivate::handleMouseReleaseEvent(QQuickItem *item, QMouseEvent { const bool wasGrabbed = ungrabMouse(event); if (!wasGrabbed) - handleRelease(item->mapToScene(event->localPos())); + handleRelease(item->mapToScene(event->localPos()), event->timestamp()); popupItem->setKeepMouseGrab(false); pressPoint = QPoint(); diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp index a3ff4f20..b4c3b84e 100644 --- a/src/quicktemplates2/qquickpopup.cpp +++ b/src/quicktemplates2/qquickpopup.cpp @@ -307,17 +307,20 @@ bool QQuickPopupPrivate::acceptTouch(const QTouchEvent::TouchPoint &point) return false; } -void QQuickPopupPrivate::handlePress(const QPointF &point) +void QQuickPopupPrivate::handlePress(const QPointF &point, ulong timestamp) { + Q_UNUSED(timestamp); tryClose(point, QQuickPopup::CloseOnPressOutside | QQuickPopup::CloseOnPressOutsideParent); } -void QQuickPopupPrivate::handleMove(const QPointF &) +void QQuickPopupPrivate::handleMove(const QPointF &, ulong timestamp) { + Q_UNUSED(timestamp); } -void QQuickPopupPrivate::handleRelease(const QPointF &point) +void QQuickPopupPrivate::handleRelease(const QPointF &point, ulong timestamp) { + Q_UNUSED(timestamp); tryClose(point, QQuickPopup::CloseOnReleaseOutside | QQuickPopup::CloseOnReleaseOutsideParent); touchId = -1; } @@ -339,13 +342,13 @@ void QQuickPopupPrivate::handleMouseEvent(QQuickItem *item, QMouseEvent *event) QPointF pos = item->mapToScene(event->localPos()); switch (event->type()) { case QEvent::MouseButtonPress: - handlePress(pos); + handlePress(pos, event->timestamp()); break; case QEvent::MouseMove: - handleMove(pos); + handleMove(pos, event->timestamp()); break; case QEvent::MouseButtonRelease: - handleRelease(pos); + handleRelease(pos, event->timestamp()); break; default: Q_UNREACHABLE(); @@ -359,7 +362,7 @@ void QQuickPopupPrivate::handleTouchEvent(QQuickItem *item, QTouchEvent *event) case QEvent::TouchBegin: for (const QTouchEvent::TouchPoint &point : event->touchPoints()) { if (acceptTouch(point)) - handlePress(item->mapToScene(point.pos())); + handlePress(item->mapToScene(point.pos()), event->timestamp()); } break; @@ -370,13 +373,13 @@ void QQuickPopupPrivate::handleTouchEvent(QQuickItem *item, QTouchEvent *event) switch (point.state()) { case Qt::TouchPointPressed: - handlePress(item->mapToScene(point.pos())); + handlePress(item->mapToScene(point.pos()), event->timestamp()); break; case Qt::TouchPointMoved: - handleMove(item->mapToScene(point.pos())); + handleMove(item->mapToScene(point.pos()), event->timestamp()); break; case Qt::TouchPointReleased: - handleRelease(item->mapToScene(point.pos())); + handleRelease(item->mapToScene(point.pos()), event->timestamp()); break; default: break; @@ -387,7 +390,7 @@ void QQuickPopupPrivate::handleTouchEvent(QQuickItem *item, QTouchEvent *event) case QEvent::TouchEnd: for (const QTouchEvent::TouchPoint &point : event->touchPoints()) { if (acceptTouch(point)) - handleRelease(item->mapToScene(point.pos())); + handleRelease(item->mapToScene(point.pos()), event->timestamp()); } break; diff --git a/src/quicktemplates2/qquickpopup_p_p.h b/src/quicktemplates2/qquickpopup_p_p.h index 2ca11efe..56226bd9 100644 --- a/src/quicktemplates2/qquickpopup_p_p.h +++ b/src/quicktemplates2/qquickpopup_p_p.h @@ -98,9 +98,9 @@ public: bool tryClose(const QPointF &pos, QQuickPopup::ClosePolicy flags); virtual bool acceptTouch(const QTouchEvent::TouchPoint &point); - virtual void handlePress(const QPointF &point); - virtual void handleMove(const QPointF &point); - virtual void handleRelease(const QPointF &point); + virtual void handlePress(const QPointF &point, ulong timestamp); + virtual void handleMove(const QPointF &point, ulong timestamp); + virtual void handleRelease(const QPointF &point, ulong timestamp); virtual void handleUngrab(); void handleMouseEvent(QQuickItem *item, QMouseEvent *event); |