diff options
author | Martin Jones <martin.jones@nokia.com> | 2011-02-01 03:09:44 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2011-02-01 03:09:44 (GMT) |
commit | 88b072b3644cfd960367096ae0103e8ddef0d06d (patch) | |
tree | b3628c5e6d89d0827714140c59928118804d8d91 /src | |
parent | ce87671e0143e3e665c076974482f3ae50850058 (diff) | |
download | Qt-88b072b3644cfd960367096ae0103e8ddef0d06d.zip Qt-88b072b3644cfd960367096ae0103e8ddef0d06d.tar.gz Qt-88b072b3644cfd960367096ae0103e8ddef0d06d.tar.bz2 |
PinchArea sometimes failed.
Almost always failed on Mac and could fail on other systems due to
QDeclarativePinchEvent::m_accepted not being initialized.
Task-number: QTBUG-15491
Reviewed-by: Bea Lam
Diffstat (limited to 'src')
3 files changed, 6 insertions, 3 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativepincharea.cpp b/src/declarative/graphicsitems/qdeclarativepincharea.cpp index 436099e..eae83f6 100644 --- a/src/declarative/graphicsitems/qdeclarativepincharea.cpp +++ b/src/declarative/graphicsitems/qdeclarativepincharea.cpp @@ -312,6 +312,7 @@ void QDeclarativePinchArea::updatePinch() pe.setPoint1(d->lastPoint1); pe.setPoint2(d->lastPoint2); emit pinchFinished(&pe); + d->pinchStartDist = 0; if (d->pinch && d->pinch->target()) d->pinch->setActive(false); } @@ -363,7 +364,9 @@ void QDeclarativePinchArea::updatePinch() if (pe.accepted()) { d->inPinch = true; d->stealMouse = true; - grabMouse(); + QGraphicsScene *s = scene(); + if (s && s->mouseGrabberItem() != this) + grabMouse(); setKeepMouseGrab(true); if (d->pinch && d->pinch->target()) { d->pinchStartPos = pinch()->target()->pos(); diff --git a/src/declarative/graphicsitems/qdeclarativepincharea_p.h b/src/declarative/graphicsitems/qdeclarativepincharea_p.h index cd5423d..6d04708 100644 --- a/src/declarative/graphicsitems/qdeclarativepincharea_p.h +++ b/src/declarative/graphicsitems/qdeclarativepincharea_p.h @@ -207,7 +207,7 @@ class Q_AUTOTEST_EXPORT QDeclarativePinchEvent : public QObject public: QDeclarativePinchEvent(QPointF c, qreal s, qreal a, qreal r) - : QObject(), m_center(c), m_scale(s), m_angle(a), m_rotation(r) {} + : QObject(), m_center(c), m_scale(s), m_angle(a), m_rotation(r), m_accepted(true) {} QPointF center() const { return m_center; } QPointF startCenter() const { return m_startCenter; } diff --git a/src/declarative/graphicsitems/qdeclarativepincharea_p_p.h b/src/declarative/graphicsitems/qdeclarativepincharea_p_p.h index b1cdf68..5641e35 100644 --- a/src/declarative/graphicsitems/qdeclarativepincharea_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativepincharea_p_p.h @@ -68,7 +68,7 @@ class QDeclarativePinchAreaPrivate : public QDeclarativeItemPrivate public: QDeclarativePinchAreaPrivate() : absorb(true), stealMouse(false), inPinch(false) - , pinchRejected(false), pinch(0) + , pinchRejected(false), pinch(0), pinchStartDist(0) { } |