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 <laszlo.agocs@digia.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
This commit is contained in:
Alexander Volkov 2014-09-05 16:24:23 +04:00 committed by Shawn Rutledge
parent 289e9af668
commit f3cee50216

View File

@ -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;