summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-09-01 12:25:42 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-09-03 09:30:54 (GMT)
commit466bc1ed4bf0c466e54732b2f8f7a16a34b716a8 (patch)
treed84578adfd77b2dd72f16277db3e0c3f1339528e /examples
parenta1a0ea71d8861e2b794f2f9b55447d50fc520de3 (diff)
downloadQt-466bc1ed4bf0c466e54732b2f8f7a16a34b716a8.zip
Qt-466bc1ed4bf0c466e54732b2f8f7a16a34b716a8.tar.gz
Qt-466bc1ed4bf0c466e54732b2f8f7a16a34b716a8.tar.bz2
Improved the gesture api.
Made properties in QPanGesture and QPinchGesture more consistent - all of them have value, lastValue and totalValue. Documented that totalValue means the value from the beginning of the gesture, while the 'value' - from the beginning of the current sequence. This is especially useful on Windows when you zoom with two fingers and then release one finger and touch again to continue zooming. Also added a workaround for native Rotate gesture on Windows which contain a 'bad' value in the first WM_GESTURE message in every gesture sequence. Reviewed-by: Bradley T. Hughes
Diffstat (limited to 'examples')
-rw-r--r--examples/gestures/imageviewer/imagewidget.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/examples/gestures/imageviewer/imagewidget.cpp b/examples/gestures/imageviewer/imagewidget.cpp
index 7dbd084..a4ea238 100644
--- a/examples/gestures/imageviewer/imagewidget.cpp
+++ b/examples/gestures/imageviewer/imagewidget.cpp
@@ -123,8 +123,10 @@ void ImageWidget::panTriggered()
void ImageWidget::pinchTriggered()
{
QPinchGesture *pg = qobject_cast<QPinchGesture*>(sender());
- rotationAngle += pg->rotationAngle();
- scaleFactor += pg->scaleFactor();
+ if (pg->rotationAngle() != 0.0)
+ rotationAngle += pg->rotationAngle() - pg->lastRotationAngle();
+ if (pg->scaleFactor() != 1.0)
+ scaleFactor += pg->scaleFactor() - pg->lastScaleFactor();
update();
}