From f3cee50216b066dc204ab4482d329f4ff988b1e2 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Fri, 5 Sep 2014 16:24:23 +0400 Subject: [PATCH] Fix a conversion of coordinates of a TouchBegin event To convert coordinates to a parent's coordinate system one should translate them by an offset of a child widget relative to it's parent widget. QRect::moveCenter() doesn't translate, it sets the coordinates of the touch point's center to this offset. Change-Id: I9d823784803bd1448c0d665944090674d3ff518b Reviewed-by: Laszlo Agocs Reviewed-by: Shawn Rutledge --- src/widgets/kernel/qapplication.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index f438f60e47..3486396f54 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -3563,7 +3563,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) for (int i = 0; i < touchEvent->_touchPoints.size(); ++i) { QTouchEvent::TouchPoint &pt = touchEvent->_touchPoints[i]; QRectF rect = pt.rect(); - rect.moveCenter(offset); + rect.translate(offset); pt.d->rect = rect; pt.d->startPos = pt.startPos() + offset; pt.d->lastPos = pt.lastPos() + offset;