summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qstandardgestures.cpp
diff options
context:
space:
mode:
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