diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-11-05 11:46:12 (GMT) |
---|---|---|
committer | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-11-05 11:54:55 (GMT) |
commit | 75da4b5855c63b41060886c7b8ed7856888e4e35 (patch) | |
tree | cd1b55ffb3491fa7647c37949b0f03d14af6759a /src/gui | |
parent | 6777135b2cacd3a72a60ff372749837b67762fbe (diff) | |
download | Qt-75da4b5855c63b41060886c7b8ed7856888e4e35.zip Qt-75da4b5855c63b41060886c7b8ed7856888e4e35.tar.gz Qt-75da4b5855c63b41060886c7b8ed7856888e4e35.tar.bz2 |
Fixed pinching in the imagegestures example.
When the gesture finishes it might not necessery set the ScaleFactorChanged
flag.
Also fixed the touch-event based pinch gesture.
Reviewed-by: trustme
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qstandardgestures.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp index 3cc1b4b..0ea4764 100644 --- a/src/gui/kernel/qstandardgestures.cpp +++ b/src/gui/kernel/qstandardgestures.cpp @@ -205,7 +205,7 @@ QGestureRecognizer::Result QPinchGestureRecognizer::recognize(QGesture *state, d->changeFlags |= QPinchGesture::CenterPointChanged; const qreal scaleFactor = - QLineF(p1.pos(), p2.pos()).length() + QLineF(p1.screenPos(), p2.screenPos()).length() / QLineF(d->startPosition[0], d->startPosition[1]).length(); if (d->isNewSequence) { d->lastScaleFactor = scaleFactor; @@ -236,7 +236,10 @@ QGestureRecognizer::Result QPinchGestureRecognizer::recognize(QGesture *state, result = QGestureRecognizer::TriggerGesture; } else { d->isNewSequence = true; - result = QGestureRecognizer::MayBeGesture; + if (q->state() == Qt::NoGesture) + result = QGestureRecognizer::Ignore; + else + result = QGestureRecognizer::FinishGesture; } break; } @@ -264,6 +267,7 @@ void QPinchGestureRecognizer::reset(QGesture *state) d->totalRotationAngle = d->lastRotationAngle = d->rotationAngle = 0; d->isNewSequence = true; + d->startPosition[0] = d->startPosition[1] = QPointF(); QGestureRecognizer::reset(state); } |