From 7856c0397a42d26fa4fdd3ead3df7886b408b8ed Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Thu, 22 Oct 2009 20:15:36 +0200 Subject: Compile fix. QPanGesture was changed to use QPointF instead of QSizeF, also need to change all usages of the pan gesture. Reviewed-by: trustme --- examples/gestures/imagegestures/imagewidget.cpp | 6 ++-- src/gui/kernel/qmacgesturerecognizer_mac.mm | 8 ++--- tests/manual/gestures/graphicsview/main.cpp | 6 ++-- .../graphicsview/mousepangesturerecognizer.cpp | 10 +++--- tests/manual/gestures/scrollarea/main.cpp | 36 +++++++++++----------- .../scrollarea/mousepangesturerecognizer.cpp | 10 +++--- 6 files changed, 38 insertions(+), 38 deletions(-) diff --git a/examples/gestures/imagegestures/imagewidget.cpp b/examples/gestures/imagegestures/imagewidget.cpp index 95525c5..28de6da 100644 --- a/examples/gestures/imagegestures/imagewidget.cpp +++ b/examples/gestures/imagegestures/imagewidget.cpp @@ -128,9 +128,9 @@ void ImageWidget::panTriggered(QPanGesture *gesture) setCursor(Qt::ArrowCursor); } #endif - QSizeF lastOffset = gesture->offset(); - horizontalOffset += lastOffset.width(); - verticalOffset += lastOffset.height(); + QPointF lastOffset = gesture->offset(); + horizontalOffset += lastOffset.x(); + verticalOffset += lastOffset.y(); update(); } diff --git a/src/gui/kernel/qmacgesturerecognizer_mac.mm b/src/gui/kernel/qmacgesturerecognizer_mac.mm index 7b19a54..7019580 100644 --- a/src/gui/kernel/qmacgesturerecognizer_mac.mm +++ b/src/gui/kernel/qmacgesturerecognizer_mac.mm @@ -218,7 +218,7 @@ QMacPanGestureRecognizer::filterEvent(QGesture *gesture, QObject *target, QEvent const QPointF p = QCursor::pos(); const QPointF posOffset = p - _lastPos; g->setLastOffset(g->offset()); - g->setOffset(QSizeF(posOffset.x(), posOffset.y())); + g->setOffset(QPointF(posOffset.x(), posOffset.y())); g->setTotalOffset(g->lastOffset() + g->offset()); _lastPos = p; return QGestureRecognizer::GestureTriggered; @@ -256,9 +256,9 @@ void QMacPanGestureRecognizer::reset(QGesture *gesture) _startPos = QPointF(); _lastPos = QPointF(); _panCanceled = true; - g->setOffset(QSizeF(0, 0)); - g->setLastOffset(QSizeF(0, 0)); - g->setTotalOffset(QSizeF(0, 0)); + g->setOffset(QPointF(0, 0)); + g->setLastOffset(QPointF(0, 0)); + g->setTotalOffset(QPointF(0, 0)); g->setAcceleration(qreal(1)); QGestureRecognizer::reset(gesture); } diff --git a/tests/manual/gestures/graphicsview/main.cpp b/tests/manual/gestures/graphicsview/main.cpp index b4d74e4..e9065eb 100644 --- a/tests/manual/gestures/graphicsview/main.cpp +++ b/tests/manual/gestures/graphicsview/main.cpp @@ -66,11 +66,11 @@ protected: default: qDebug("view: Pan: "); break; } - const QSizeF offset = pan->offset(); + const QPointF offset = pan->offset(); QScrollBar *vbar = verticalScrollBar(); QScrollBar *hbar = horizontalScrollBar(); - vbar->setValue(vbar->value() - offset.height()); - hbar->setValue(hbar->value() - offset.width()); + vbar->setValue(vbar->value() - offset.y()); + hbar->setValue(hbar->value() - offset.x()); ge->accept(pan); return true; } diff --git a/tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp b/tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp index acd525f..6cdbe12 100644 --- a/tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp +++ b/tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp @@ -87,8 +87,8 @@ QGestureRecognizer::Result MousePanGestureRecognizer::filterEvent(QGesture *stat QPoint lastPos = g->property("lastPos").toPoint(); g->setLastOffset(g->offset()); lastPos = pos - lastPos; - g->setOffset(QSizeF(lastPos.x(), lastPos.y())); - g->setTotalOffset(g->totalOffset() + QSizeF(lastPos.x(), lastPos.y())); + g->setOffset(QPointF(lastPos.x(), lastPos.y())); + g->setTotalOffset(g->totalOffset() + QPointF(lastPos.x(), lastPos.y())); g->setProperty("lastPos", pos); return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint; } @@ -102,9 +102,9 @@ QGestureRecognizer::Result MousePanGestureRecognizer::filterEvent(QGesture *stat void MousePanGestureRecognizer::reset(QGesture *state) { QPanGesture *g = static_cast(state); - g->setTotalOffset(QSizeF()); - g->setLastOffset(QSizeF()); - g->setOffset(QSizeF()); + g->setTotalOffset(QPointF()); + g->setLastOffset(QPointF()); + g->setOffset(QPointF()); g->setAcceleration(0); g->setProperty("lastPos", QVariant()); g->setProperty("pressed", QVariant::fromValue(false)); diff --git a/tests/manual/gestures/scrollarea/main.cpp b/tests/manual/gestures/scrollarea/main.cpp index 2796637..f90f6c6 100644 --- a/tests/manual/gestures/scrollarea/main.cpp +++ b/tests/manual/gestures/scrollarea/main.cpp @@ -87,23 +87,23 @@ protected: if (outside) return; - const QSizeF offset = pan->offset(); - const QSizeF totalOffset = pan->totalOffset(); + const QPointF offset = pan->offset(); + const QPointF totalOffset = pan->totalOffset(); QScrollBar *vbar = verticalScrollBar(); QScrollBar *hbar = horizontalScrollBar(); - if ((vbar->value() == vbar->minimum() && totalOffset.height() > 10) || - (vbar->value() == vbar->maximum() && totalOffset.height() < -10)) { + if ((vbar->value() == vbar->minimum() && totalOffset.y() > 10) || + (vbar->value() == vbar->maximum() && totalOffset.y() < -10)) { outside = true; return; } - if ((hbar->value() == hbar->minimum() && totalOffset.width() > 10) || - (hbar->value() == hbar->maximum() && totalOffset.width() < -10)) { + if ((hbar->value() == hbar->minimum() && totalOffset.x() > 10) || + (hbar->value() == hbar->maximum() && totalOffset.x() < -10)) { outside = true; return; } - vbar->setValue(vbar->value() - offset.height()); - hbar->setValue(hbar->value() - offset.width()); + vbar->setValue(vbar->value() - offset.y()); + hbar->setValue(hbar->value() - offset.x()); event->accept(pan); } } @@ -147,28 +147,28 @@ protected: event->ignore(pan); if (outside) return; - const QSizeF offset = pan->offset(); - const QSizeF totalOffset = pan->totalOffset(); + const QPointF offset = pan->offset(); + const QPointF totalOffset = pan->totalOffset(); if (orientation() == Qt::Horizontal) { - if ((value() == minimum() && totalOffset.width() < -10) || - (value() == maximum() && totalOffset.width() > 10)) { + if ((value() == minimum() && totalOffset.x() < -10) || + (value() == maximum() && totalOffset.x() > 10)) { outside = true; return; } - if (totalOffset.height() < 40 && totalOffset.height() > -40) { - setValue(value() + offset.width()); + if (totalOffset.y() < 40 && totalOffset.y() > -40) { + setValue(value() + offset.x()); event->accept(pan); } else { outside = true; } } else if (orientation() == Qt::Vertical) { - if ((value() == maximum() && totalOffset.height() < -10) || - (value() == minimum() && totalOffset.height() > 10)) { + if ((value() == maximum() && totalOffset.y() < -10) || + (value() == minimum() && totalOffset.y() > 10)) { outside = true; return; } - if (totalOffset.width() < 40 && totalOffset.width() > -40) { - setValue(value() - offset.height()); + if (totalOffset.x() < 40 && totalOffset.x() > -40) { + setValue(value() - offset.y()); event->accept(pan); } else { outside = true; diff --git a/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp b/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp index 79b633e..5f94dbc 100644 --- a/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp +++ b/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp @@ -69,8 +69,8 @@ QGestureRecognizer::Result MousePanGestureRecognizer::filterEvent(QGesture *stat QPoint lastPos = g->property("lastPos").toPoint(); g->setLastOffset(g->offset()); lastPos = pos - lastPos; - g->setOffset(QSizeF(lastPos.x(), lastPos.y())); - g->setTotalOffset(g->totalOffset() + QSizeF(lastPos.x(), lastPos.y())); + g->setOffset(QPointF(lastPos.x(), lastPos.y())); + g->setTotalOffset(g->totalOffset() + QPointF(lastPos.x(), lastPos.y())); g->setProperty("lastPos", pos); return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint; } @@ -84,9 +84,9 @@ QGestureRecognizer::Result MousePanGestureRecognizer::filterEvent(QGesture *stat void MousePanGestureRecognizer::reset(QGesture *state) { QPanGesture *g = static_cast(state); - g->setTotalOffset(QSizeF()); - g->setLastOffset(QSizeF()); - g->setOffset(QSizeF()); + g->setTotalOffset(QPointF()); + g->setLastOffset(QPointF()); + g->setOffset(QPointF()); g->setAcceleration(0); g->setProperty("lastPos", QVariant()); g->setProperty("pressed", QVariant::fromValue(false)); -- cgit v0.12