summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-10-25 22:02:42 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-10-25 22:02:42 (GMT)
commitef704ebad66559170d761459d42d6c99996db529 (patch)
treee7772e3e9fec69d2816d36c5bb73441facf7d06b /src/gui
parent667d94f6ab824a9b56c28943f02054467741e070 (diff)
parent4117403ad5170110849b7d0663337b1571304a8e (diff)
downloadQt-ef704ebad66559170d761459d42d6c99996db529.zip
Qt-ef704ebad66559170d761459d42d6c99996db529.tar.gz
Qt-ef704ebad66559170d761459d42d6c99996db529.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: Simplify calculation of center point and scale for PinchRecongizer Doc: Fixing typo QtDFB: Make transparent windows behave better For meego graphics system, use floyd-steinberg dithering when converting to 16bit. Added support for blitting to native child widgets in GL window surface.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qstandardgestures.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp
index 893ba2b..1821c3d 100644
--- a/src/gui/kernel/qstandardgestures.cpp
+++ b/src/gui/kernel/qstandardgestures.cpp
@@ -198,25 +198,22 @@ QGestureRecognizer::Result QPinchGestureRecognizer::recognize(QGesture *state,
d->startPosition[0] = p1.screenPos();
d->startPosition[1] = p2.screenPos();
}
- QLineF line(p1.screenPos(), p2.screenPos());
- QLineF lastLine(p1.lastScreenPos(), p2.lastScreenPos());
- QLineF tmp(line);
- tmp.setLength(line.length() / 2.);
- QPointF centerPoint = tmp.p2();
d->lastCenterPoint = d->centerPoint;
- d->centerPoint = centerPoint;
- d->changeFlags |= QPinchGesture::CenterPointChanged;
+ d->centerPoint = (p1.screenPos() + p2.screenPos()) / 2.0;
- const qreal scaleFactor = line.length() / lastLine.length();
+ d->changeFlags |= QPinchGesture::CenterPointChanged;
if (d->isNewSequence) {
- d->lastScaleFactor = scaleFactor;
+ d->scaleFactor = 1.0;
+ d->lastScaleFactor = 1.0;
} else {
d->lastScaleFactor = d->scaleFactor;
+ QLineF line(p1.screenPos(), p2.screenPos());
+ QLineF lastLine(p1.lastScreenPos(), p2.lastScreenPos());
+ d->scaleFactor = line.length() / lastLine.length();
}
- d->scaleFactor = scaleFactor;
- d->totalScaleFactor = d->totalScaleFactor * scaleFactor;
+ d->totalScaleFactor = d->totalScaleFactor * d->scaleFactor;
d->changeFlags |= QPinchGesture::ScaleFactorChanged;
qreal angle = QLineF(p1.screenPos(), p2.screenPos()).angle();