From c6151f84a7bd7cadb5f86d58582fb659ce4fae09 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 24 Apr 2017 22:06:47 +0200 Subject: QQuickDrawer: override handlePress/Move/Release/Ungrab() Change-Id: Id947e868aa1c89aaab0cb6988b76f0cfe25d8339 Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquickdrawer.cpp | 39 +++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 12 deletions(-) (limited to 'src/quicktemplates2/qquickdrawer.cpp') diff --git a/src/quicktemplates2/qquickdrawer.cpp b/src/quicktemplates2/qquickdrawer.cpp index 862b36dc..7ecd1558 100644 --- a/src/quicktemplates2/qquickdrawer.cpp +++ b/src/quicktemplates2/qquickdrawer.cpp @@ -393,13 +393,36 @@ bool QQuickDrawerPrivate::ungrabMouse(QMouseEvent *event) return wasGrabbed; } -bool QQuickDrawerPrivate::handleMousePressEvent(QQuickItem *item, QMouseEvent *event) +void QQuickDrawerPrivate::handlePress(const QPointF &point, ulong timestamp) { - handlePress(item->mapToScene(event->localPos()), event->timestamp()); + QQuickPopupPrivate::handlePress(point, timestamp); offset = 0; - pressPoint = event->windowPos(); - velocityCalculator.startMeasuring(pressPoint, event->timestamp()); + pressPoint = point; + velocityCalculator.startMeasuring(point, timestamp); +} + +void QQuickDrawerPrivate::handleMove(const QPointF &point, ulong timestamp) +{ + QQuickPopupPrivate::handleMove(point, timestamp); +} + +void QQuickDrawerPrivate::handleRelease(const QPointF &point, ulong timestamp) +{ + QQuickPopupPrivate::handleRelease(point, timestamp); +} + +void QQuickDrawerPrivate::handleUngrab() +{ + QQuickPopupPrivate::handleUngrab(); + + pressPoint = QPoint(); + velocityCalculator.reset(); +} + +bool QQuickDrawerPrivate::handleMousePressEvent(QQuickItem *item, QMouseEvent *event) +{ + handlePress(item->mapToScene(event->localPos()), event->timestamp()); // don't block press events // a) outside a non-modal drawer, @@ -668,14 +691,6 @@ void QQuickDrawer::mouseReleaseEvent(QMouseEvent *event) d->handleMouseReleaseEvent(d->popupItem, event); } -void QQuickDrawer::mouseUngrabEvent() -{ - Q_D(QQuickDrawer); - QQuickPopup::mouseUngrabEvent(); - d->pressPoint = QPoint(); - d->velocityCalculator.reset(); -} - bool QQuickDrawer::overlayEvent(QQuickItem *item, QEvent *event) { Q_D(QQuickDrawer); -- cgit v1.2.3