summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorThomas Zander <thomas.zander@trolltech.com>2009-10-20 13:43:05 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-10-22 14:59:20 (GMT)
commit04302702c5e7938fb4ae8bc41d78486725e62ae7 (patch)
treeafc1643a16dec5079f82f219418ba1d2a76dbb04 /src/gui
parentee6d3a13a04c2fb5cfef8a18fd370ef1f605555a (diff)
downloadQt-04302702c5e7938fb4ae8bc41d78486725e62ae7.zip
Qt-04302702c5e7938fb4ae8bc41d78486725e62ae7.tar.gz
Qt-04302702c5e7938fb4ae8bc41d78486725e62ae7.tar.bz2
Change API; the pan gesture now has points for distance, not size.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qgesture.cpp12
-rw-r--r--src/gui/kernel/qgesture.h18
-rw-r--r--src/gui/kernel/qgesture_p.h6
-rw-r--r--src/gui/kernel/qstandardgestures.cpp12
4 files changed, 24 insertions, 24 deletions
diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp
index f044c09..ecdd661 100644
--- a/src/gui/kernel/qgesture.cpp
+++ b/src/gui/kernel/qgesture.cpp
@@ -235,17 +235,17 @@ QPanGesture::QPanGesture(QObject *parent)
d_func()->gestureType = Qt::PanGesture;
}
-QSizeF QPanGesture::totalOffset() const
+QPointF QPanGesture::totalOffset() const
{
return d_func()->totalOffset;
}
-QSizeF QPanGesture::lastOffset() const
+QPointF QPanGesture::lastOffset() const
{
return d_func()->lastOffset;
}
-QSizeF QPanGesture::offset() const
+QPointF QPanGesture::offset() const
{
return d_func()->offset;
}
@@ -256,17 +256,17 @@ qreal QPanGesture::acceleration() const
}
-void QPanGesture::setTotalOffset(const QSizeF &value)
+void QPanGesture::setTotalOffset(const QPointF &value)
{
d_func()->totalOffset = value;
}
-void QPanGesture::setLastOffset(const QSizeF &value)
+void QPanGesture::setLastOffset(const QPointF &value)
{
d_func()->lastOffset = value;
}
-void QPanGesture::setOffset(const QSizeF &value)
+void QPanGesture::setOffset(const QPointF &value)
{
d_func()->offset = value;
}
diff --git a/src/gui/kernel/qgesture.h b/src/gui/kernel/qgesture.h
index 9d1c11e..6469959 100644
--- a/src/gui/kernel/qgesture.h
+++ b/src/gui/kernel/qgesture.h
@@ -96,22 +96,22 @@ class Q_GUI_EXPORT QPanGesture : public QGesture
Q_OBJECT
Q_DECLARE_PRIVATE(QPanGesture)
- Q_PROPERTY(QSizeF totalOffset READ totalOffset WRITE setTotalOffset)
- Q_PROPERTY(QSizeF lastOffset READ lastOffset WRITE setLastOffset)
- Q_PROPERTY(QSizeF offset READ offset WRITE setOffset)
+ Q_PROPERTY(QPointF totalOffset READ totalOffset WRITE setTotalOffset)
+ Q_PROPERTY(QPointF lastOffset READ lastOffset WRITE setLastOffset)
+ Q_PROPERTY(QPointF offset READ offset WRITE setOffset)
Q_PROPERTY(qreal acceleration READ acceleration WRITE setAcceleration)
public:
QPanGesture(QObject *parent = 0);
- QSizeF totalOffset() const;
- QSizeF lastOffset() const;
- QSizeF offset() const;
+ QPointF totalOffset() const;
+ QPointF lastOffset() const;
+ QPointF offset() const;
qreal acceleration() const;
- void setTotalOffset(const QSizeF &value);
- void setLastOffset(const QSizeF &value);
- void setOffset(const QSizeF &value);
+ void setTotalOffset(const QPointF &value);
+ void setLastOffset(const QPointF &value);
+ void setOffset(const QPointF &value);
void setAcceleration(qreal value);
friend class QPanGestureRecognizer;
diff --git a/src/gui/kernel/qgesture_p.h b/src/gui/kernel/qgesture_p.h
index 10887f6..975c0c9 100644
--- a/src/gui/kernel/qgesture_p.h
+++ b/src/gui/kernel/qgesture_p.h
@@ -89,9 +89,9 @@ public:
{
}
- QSizeF totalOffset;
- QSizeF lastOffset;
- QSizeF offset;
+ QPointF totalOffset;
+ QPointF lastOffset;
+ QPointF offset;
QPoint lastPosition;
qreal acceleration;
};
diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp
index dfc3499..a136379 100644
--- a/src/gui/kernel/qstandardgestures.cpp
+++ b/src/gui/kernel/qstandardgestures.cpp
@@ -73,7 +73,7 @@ QGestureRecognizer::Result QPanGestureRecognizer::filterEvent(QGesture *state, Q
result = QGestureRecognizer::MaybeGesture;
QTouchEvent::TouchPoint p = ev->touchPoints().at(0);
d->lastPosition = p.pos().toPoint();
- d->lastOffset = d->totalOffset = d->offset = QSize();
+ d->lastOffset = d->totalOffset = d->offset = QPointF();
break;
}
case QEvent::TouchEnd: {
@@ -83,7 +83,7 @@ QGestureRecognizer::Result QPanGestureRecognizer::filterEvent(QGesture *state, Q
QTouchEvent::TouchPoint p2 = ev->touchPoints().at(1);
d->lastOffset = d->offset;
d->offset =
- QSize(p1.pos().x() - p1.lastPos().x() + p2.pos().x() - p2.lastPos().x(),
+ QPointF(p1.pos().x() - p1.lastPos().x() + p2.pos().x() - p2.lastPos().x(),
p1.pos().y() - p1.lastPos().y() + p2.pos().y() - p2.lastPos().y()) / 2;
d->totalOffset += d->offset;
}
@@ -99,11 +99,11 @@ QGestureRecognizer::Result QPanGestureRecognizer::filterEvent(QGesture *state, Q
QTouchEvent::TouchPoint p2 = ev->touchPoints().at(1);
d->lastOffset = d->offset;
d->offset =
- QSize(p1.pos().x() - p1.lastPos().x() + p2.pos().x() - p2.lastPos().x(),
+ QPointF(p1.pos().x() - p1.lastPos().x() + p2.pos().x() - p2.lastPos().x(),
p1.pos().y() - p1.lastPos().y() + p2.pos().y() - p2.lastPos().y()) / 2;
d->totalOffset += d->offset;
- if (d->totalOffset.width() > 10 || d->totalOffset.height() > 10 ||
- d->totalOffset.width() < -10 || d->totalOffset.height() < -10) {
+ if (d->totalOffset.x() > 10 || d->totalOffset.y() > 10 ||
+ d->totalOffset.x() < -10 || d->totalOffset.y() < -10) {
result = QGestureRecognizer::GestureTriggered;
} else {
result = QGestureRecognizer::MaybeGesture;
@@ -128,7 +128,7 @@ void QPanGestureRecognizer::reset(QGesture *state)
QPanGesture *pan = static_cast<QPanGesture*>(state);
QPanGesturePrivate *d = pan->d_func();
- d->totalOffset = d->lastOffset = d->offset = QSizeF();
+ d->totalOffset = d->lastOffset = d->offset = QPointF();
d->lastPosition = QPoint();
d->acceleration = 0;