diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-06-08 12:00:24 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-06-08 12:00:24 (GMT) |
commit | 6e565768dd30bd3a489cea0dfd7715c93df62522 (patch) | |
tree | dff0df5bede93f16d4058fb3b6609eae8913e2e5 /src/gui/kernel/qapplication.cpp | |
parent | 9c72d33fa4eadd6267ab05fbe733cdd54067b5c1 (diff) | |
download | Qt-6e565768dd30bd3a489cea0dfd7715c93df62522.zip Qt-6e565768dd30bd3a489cea0dfd7715c93df62522.tar.gz Qt-6e565768dd30bd3a489cea0dfd7715c93df62522.tar.bz2 |
set the start and last global positions when translating "raw" touch events
this makes it possible to have a little code as possible feeding the
raw events into Qt (and tests/auto/qtouchevent passes now too :P)
Diffstat (limited to 'src/gui/kernel/qapplication.cpp')
-rw-r--r-- | src/gui/kernel/qapplication.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 00399fc..e5cf0b5 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -5305,7 +5305,7 @@ bool QApplicationPrivate::translateRawTouchEvent(QWidget *window, QHash<QWidget *, StatesAndTouchPoints> widgetsNeedingEvents; for (int i = 0; i < touchPoints.count(); ++i) { - const QTouchEvent::TouchPoint &touchPoint = touchPoints.at(i); + QTouchEvent::TouchPoint touchPoint = touchPoints.at(i); // update state QWidget *widget = 0; @@ -5328,21 +5328,30 @@ bool QApplicationPrivate::translateRawTouchEvent(QWidget *window, widget = closestWidget; } d->widgetForTouchPointId[touchPoint.id()] = widget; + touchPoint.setStartGlobalPos(touchPoint.globalPos()); + touchPoint.setLastGlobalPos(touchPoint.globalPos()); d->appCurrentTouchPoints.insert(touchPoint.id(), touchPoint); break; } case Qt::TouchPointReleased: + { widget = d->widgetForTouchPointId.take(touchPoint.id()); if (!widget) continue; - d->appCurrentTouchPoints.remove(touchPoint.id()); + QTouchEvent::TouchPoint previousTouchPoint = d->appCurrentTouchPoints.take(touchPoint.id()); + touchPoint.setStartGlobalPos(previousTouchPoint.startGlobalPos()); + touchPoint.setLastGlobalPos(previousTouchPoint.globalPos()); break; + } default: widget = d->widgetForTouchPointId.value(touchPoint.id()); if (!widget) continue; Q_ASSERT(d->appCurrentTouchPoints.contains(touchPoint.id())); + QTouchEvent::TouchPoint previousTouchPoint = d->appCurrentTouchPoints.value(touchPoint.id()); + touchPoint.setStartGlobalPos(previousTouchPoint.startGlobalPos()); + touchPoint.setLastGlobalPos(previousTouchPoint.globalPos()); d->appCurrentTouchPoints[touchPoint.id()] = touchPoint; break; } |