summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorAlexander Volkov <a.volkov@rusbitech.ru>2015-01-14 19:27:22 +0300
committerAlexander Volkov <a.volkov@rusbitech.ru>2015-04-16 15:22:36 +0000
commit0c28e1ab7a430d56702cb8545320356de3bda711 (patch)
treed9f79b0042caca8f081518d6295d78bcda009478 /src/widgets
parentf58e882b7594c59b6050d3c87562fcf836d10f60 (diff)
Fix finding the closest active touch point for the pressed touch point
Currently pressed touch point is added to the list of active touch points in Gui module. It must be excluded from consideration when we traverse the list. Task-number: QTBUG-43255 Change-Id: Idddab093b1f6a79122cf18fad7f43bfc93ce7eea Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/kernel/qapplication.cpp7
-rw-r--r--src/widgets/kernel/qapplication_p.h2
2 files changed, 5 insertions, 4 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index abd0231b00..ba14a06af4 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -4275,15 +4275,16 @@ void QApplicationPrivate::cleanupMultitouch_sys()
{
}
-QWidget *QApplicationPrivate::findClosestTouchPointTarget(QTouchDevice *device, const QPointF &screenPos)
+QWidget *QApplicationPrivate::findClosestTouchPointTarget(QTouchDevice *device, const QTouchEvent::TouchPoint &touchPoint)
{
+ const QPointF screenPos = touchPoint.screenPos();
int closestTouchPointId = -1;
QObject *closestTarget = 0;
qreal closestDistance = qreal(0.);
QHash<ActiveTouchPointsKey, ActiveTouchPointsValue>::const_iterator it = activeTouchPoints.constBegin(),
ite = activeTouchPoints.constEnd();
while (it != ite) {
- if (it.key().device == device) {
+ if (it.key().device == device && it.key().touchPointId != touchPoint.id()) {
const QTouchEvent::TouchPoint &touchPoint = it->touchPoint;
qreal dx = screenPos.x() - touchPoint.screenPos().x();
qreal dy = screenPos.y() - touchPoint.screenPos().y();
@@ -4339,7 +4340,7 @@ bool QApplicationPrivate::translateRawTouchEvent(QWidget *window,
}
if (device->type() == QTouchDevice::TouchScreen) {
- QWidget *closestWidget = d->findClosestTouchPointTarget(device, touchPoint.screenPos());
+ QWidget *closestWidget = d->findClosestTouchPointTarget(device, touchPoint);
QWidget *widget = static_cast<QWidget *>(target.data());
if (closestWidget
&& (widget->isAncestorOf(closestWidget) || closestWidget->isAncestorOf(widget))) {
diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h
index 7d97235c66..7f76d1ba97 100644
--- a/src/widgets/kernel/qapplication_p.h
+++ b/src/widgets/kernel/qapplication_p.h
@@ -280,7 +280,7 @@ public:
void initializeMultitouch_sys();
void cleanupMultitouch();
void cleanupMultitouch_sys();
- QWidget *findClosestTouchPointTarget(QTouchDevice *device, const QPointF &screenPos);
+ QWidget *findClosestTouchPointTarget(QTouchDevice *device, const QTouchEvent::TouchPoint &touchPoint);
void appendTouchPoint(const QTouchEvent::TouchPoint &touchPoint);
void removeTouchPoint(int touchPointId);
static bool translateRawTouchEvent(QWidget *widget,