summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qstandardgestures.cpp
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-09-02 15:59:11 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-09-03 09:30:55 (GMT)
commit70f5d838e42b6c34a28de54b5294d18b11529c8a (patch)
tree2f97da0618383deafccae40254313c77fa434bef /src/gui/kernel/qstandardgestures.cpp
parent466bc1ed4bf0c466e54732b2f8f7a16a34b716a8 (diff)
downloadQt-70f5d838e42b6c34a28de54b5294d18b11529c8a.zip
Qt-70f5d838e42b6c34a28de54b5294d18b11529c8a.tar.gz
Qt-70f5d838e42b6c34a28de54b5294d18b11529c8a.tar.bz2
Added a property to QPinchGesture to specify what exactly changed.
Added QPinchGesture::whatChanged() which specifies which property in the pinch gesture changed - the scale factor or rotation angle or both. Reviewed-by: Bradley T. Hughes
Diffstat (limited to 'src/gui/kernel/qstandardgestures.cpp')
-rw-r--r--src/gui/kernel/qstandardgestures.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp
index 783c1d3..8e76715 100644
--- a/src/gui/kernel/qstandardgestures.cpp
+++ b/src/gui/kernel/qstandardgestures.cpp
@@ -413,6 +413,7 @@ bool QPinchGesture::eventFilter(QObject *receiver, QEvent *event)
// next we might receive the first gesture update event, so we
// prepare for it.
d->state = Qt::NoGesture;
+ d->changes = 0;
d->totalScaleFactor = d->scaleFactor = d->lastScaleFactor = 1.;
d->totalRotationAngle = d->rotationAngle = d->lastRotationAngle = 0.;
d->startCenterPoint = d->centerPoint = d->lastCenterPoint = QPointF();
@@ -460,6 +461,7 @@ bool QPinchGesture::eventFilter(QObject *receiver, QEvent *event)
if (!windowsRotateWorkaround)
nextState = Qt::GestureUpdated;
#endif
+ d->changes = QPinchGesture::RotationAngleChanged;
event->accept();
break;
}
@@ -484,6 +486,7 @@ bool QPinchGesture::eventFilter(QObject *receiver, QEvent *event)
d->scaleFactor += ev->percentage;
#endif
nextState = Qt::GestureUpdated;
+ d->changes = QPinchGesture::ScaleFactorChanged;
event->accept();
break;
case QNativeGestureEvent::GestureEnd:
@@ -498,6 +501,8 @@ bool QPinchGesture::eventFilter(QObject *receiver, QEvent *event)
d->startCenterPoint = d->centerPoint;
d->lastCenterPoint = d->centerPoint;
d->centerPoint = static_cast<QWidget*>(receiver)->mapFromGlobal(ev->position);
+ if (d->lastCenterPoint != d->centerPoint)
+ d->changes |= QPinchGesture::CenterPointChanged;
updateState(nextState);
return true;
}
@@ -523,6 +528,7 @@ bool QPinchGesture::filterEvent(QEvent *event)
void QPinchGesture::reset()
{
Q_D(QPinchGesture);
+ d->changes = 0;
d->totalScaleFactor = d->scaleFactor = d->lastScaleFactor = 1.;
d->totalRotationAngle = d->rotationAngle = d->lastRotationAngle = 0.;
d->startCenterPoint = d->centerPoint = d->lastCenterPoint = QPointF();
@@ -530,6 +536,16 @@ void QPinchGesture::reset()
}
/*!
+ \property QPinchGesture::whatChanged
+
+ Specifies which values were changed in the gesture.
+*/
+QPinchGesture::WhatChanged QPinchGesture::whatChanged() const
+{
+ return d_func()->changes;
+}
+
+/*!
\property QPinchGesture::totalScaleFactor
Specifies a total scale factor of the pinch gesture since the gesture