aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@qt.io>2017-05-10 10:09:56 +0200
committerFrederik Gladhorn <frederik.gladhorn@qt.io>2017-05-10 08:40:02 +0000
commit802a5be531a9f2b1396f4ea4715c9a1dc593f778 (patch)
tree7ed3513ef377702680ec9d28b85e9f7989cddc8d /src/quick
parent684c8086815ce1fd1db274599fac3d1d63ff0802 (diff)
Fix hover delivery in case of touch release events
This fixes tst_TouchMouse::hoverEnabled. It turns out that the problem is that QQuickWindowPrivate::flushFrameSynchronousEvents would deliver artificial hover events which (due to the nature of the function) would arrive without being synchronized with the test. This should not be a problem as such, but there was one bug: the hover event would also be sent in case of a touch release event. The definition of when to "pretend hover" is a bit shaky, but we should definitely not send hover events after touch releases. By clearing lastMousePosition instead of setting it to where the touch point is released we no longer receive bogus events. Task-number: QTBUG-55350 Change-Id: I4dea54740e37182f66c4a729d7b06a1c770c34a9 Reviewed-by: Robin Burchell <robin.burchell@crimson.no> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/items/qquickwindow.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 98901ab818..bdb362e1ff 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -1979,8 +1979,14 @@ bool QQuickWindowPrivate::compressTouchEvent(QTouchEvent *event)
void QQuickWindowPrivate::handleTouchEvent(QTouchEvent *event)
{
translateTouchEvent(event);
- if (event->touchPoints().size())
- lastMousePosition = event->touchPoints().at(0).pos();
+ if (event->touchPoints().size()) {
+ auto point = event->touchPoints().at(0);
+ if (point.state() == Qt::TouchPointReleased) {
+ lastMousePosition = QPointF();
+ } else {
+ lastMousePosition = point.pos();
+ }
+ }
qCDebug(DBG_TOUCH) << event;