From c28da4dd467c2763bed5c6b31471f078ac26cee6 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Fri, 4 Jun 2010 11:13:19 +0200 Subject: Added setting a hotspot on standard gestures In order for gestures to work in graphicsview the hotspot should be set. The fix adds the hotspot to standard gestures that are shipped with Qt. Task-number: QTBUG-10967 Task-number: QT-3406 Reviewed-by: trustme --- src/gui/kernel/qstandardgestures.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp index a575717..bfcfa86 100644 --- a/src/gui/kernel/qstandardgestures.cpp +++ b/src/gui/kernel/qstandardgestures.cpp @@ -110,6 +110,7 @@ QGestureRecognizer::Result QPanGestureRecognizer::recognize(QGesture *state, p1.pos().y() - p1.startPos().y() + p2.pos().y() - p2.startPos().y()) / 2; if (d->offset.x() > 10 || d->offset.y() > 10 || d->offset.x() < -10 || d->offset.y() < -10) { + q->setHotSpot(p1.startScreenPos()); result = QGestureRecognizer::TriggerGesture; } else { result = QGestureRecognizer::MayBeGesture; @@ -439,6 +440,7 @@ QGestureRecognizer::Result QTapGestureRecognizer::recognize(QGesture *state, switch (event->type()) { case QEvent::TouchBegin: { d->position = ev->touchPoints().at(0).pos(); + q->setHotSpot(ev->touchPoints().at(0).screenPos()); result = QGestureRecognizer::TriggerGesture; break; } @@ -521,6 +523,7 @@ QTapAndHoldGestureRecognizer::recognize(QGesture *state, QObject *object, if (d->timerId) q->killTimer(d->timerId); d->timerId = q->startTimer(TimerInterval); + q->setHotSpot(ev->touchPoints().at(0).startScreenPos()); result = QGestureRecognizer::TriggerGesture; break; case QEvent::TouchEnd: -- cgit v0.12