aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/handlers/qquickmultipointhandler.cpp
diff options
context:
space:
mode:
authorJan Arve Sæther <jan-arve.saether@qt.io>2018-07-20 15:30:09 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2018-07-23 10:51:17 +0000
commita5f1581653bf39938f052eb0138ba0e834266b0c (patch)
tree5e47338748d1552f50276c44d322d5bcdc5c5700 /src/quick/handlers/qquickmultipointhandler.cpp
parent8048eed4142e1566bff8e4ca4bfd48c7a8adb8c8 (diff)
Make sure pressPosition and scenePressPosition are correctly initialized
The problem was that QQuickMultiPointHandler::m_currentPoints were only initialized when the candidate points matched the min and max number of points. So if we wanted to do a two-finger pinch it would only initialize them when *both* fingers were pressed. Due to the checking of point->state() in QQuickHandlerPoint::reset(const QQuickEventPoint *point) it meant that it would only initialize the press position correctly for the *last* pressed point. This was because the first pressed point would at the point when reset() was called have a point->state() == QQuickEventPoint::Updated, so it would not initialize the pressPosition nor the scenePressPosition. Luckilly we can get the scenePressPosition from the QQuickEventPoint, but the pressPosition we have to explicitly localize. Change-Id: I493c736814cfbc265ec33e8a72fc4283edbbdc43 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/quick/handlers/qquickmultipointhandler.cpp')
-rw-r--r--src/quick/handlers/qquickmultipointhandler.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/quick/handlers/qquickmultipointhandler.cpp b/src/quick/handlers/qquickmultipointhandler.cpp
index d688058c4e..9eddd90a50 100644
--- a/src/quick/handlers/qquickmultipointhandler.cpp
+++ b/src/quick/handlers/qquickmultipointhandler.cpp
@@ -88,8 +88,10 @@ bool QQuickMultiPointHandler::wantsPointerEvent(QQuickPointerEvent *event)
if (ret) {
const int c = candidatePoints.count();
m_currentPoints.resize(c);
- for (int i = 0; i < c; ++i)
+ for (int i = 0; i < c; ++i) {
m_currentPoints[i].reset(candidatePoints[i]);
+ m_currentPoints[i].localize(parentItem());
+ }
} else {
m_currentPoints.clear();
}