summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qgesture.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel/qgesture.h')
-rw-r--r--src/gui/kernel/qgesture.h154
1 files changed, 134 insertions, 20 deletions
diff --git a/src/gui/kernel/qgesture.h b/src/gui/kernel/qgesture.h
index 440565e..02eb526 100644
--- a/src/gui/kernel/qgesture.h
+++ b/src/gui/kernel/qgesture.h
@@ -51,11 +51,12 @@
QT_BEGIN_HEADER
+Q_DECLARE_METATYPE(Qt::GestureState)
+
QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
-class QGraphicsItem;
class QGesturePrivate;
class Q_GUI_EXPORT QGesture : public QObject
{
@@ -63,37 +64,150 @@ class Q_GUI_EXPORT QGesture : public QObject
Q_DECLARE_PRIVATE(QGesture)
Q_PROPERTY(Qt::GestureState state READ state)
- Q_PROPERTY(QObject* gestureTarget READ gestureTarget WRITE setGestureTarget)
+ Q_PROPERTY(Qt::GestureType gestureType READ gestureType)
+ Q_PROPERTY(QPointF hotSpot READ hotSpot WRITE setHotSpot RESET unsetHotSpot)
+ Q_PROPERTY(bool hasHotSpot READ hasHotSpot)
+ Q_PROPERTY(QObject* targetObject READ targetObject WRITE setTargetObject)
public:
- explicit QGesture(QObject *gestureTarget = 0, QObject *parent = 0);
+ explicit QGesture(QObject *parent = 0);
~QGesture();
- virtual bool filterEvent(QEvent *event) = 0;
+ Qt::GestureType gestureType() const;
- void setGestureTarget(QObject *object);
- QObject* gestureTarget() const;
+ Qt::GestureState state() const;
- void setGraphicsItem(QGraphicsItem *);
- QGraphicsItem *graphicsItem() const;
+ QObject *targetObject() const;
+ void setTargetObject(QObject *value);
- Qt::GestureState state() const;
+ QPointF hotSpot() const;
+ void setHotSpot(const QPointF &value);
+ bool hasHotSpot() const;
+ void unsetHotSpot();
protected:
- QGesture(QGesturePrivate &dd, QObject *gestureTarget, QObject *parent);
- bool eventFilter(QObject*, QEvent*);
+ QGesture(QGesturePrivate &dd, QObject *parent);
+
+private:
+ friend class QGestureEvent;
+ friend class QGestureRecognizer;
+ friend class QGestureManager;
+};
- virtual void reset();
- void updateState(Qt::GestureState state);
+class QPanGesturePrivate;
+class Q_GUI_EXPORT QPanGesture : public QGesture
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QPanGesture)
-Q_SIGNALS:
- void started();
- void triggered();
- void finished();
- void canceled();
+ 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(qreal acceleration READ acceleration WRITE setAcceleration)
-private:
- friend class QWidget;
+public:
+ QPanGesture(QObject *parent = 0);
+
+ QSizeF totalOffset() const;
+ QSizeF lastOffset() const;
+ QSizeF offset() const;
+ qreal acceleration() const;
+
+ void setTotalOffset(const QSizeF &value);
+ void setLastOffset(const QSizeF &value);
+ void setOffset(const QSizeF &value);
+ void setAcceleration(qreal value);
+
+ friend class QPanGestureRecognizer;
+ friend class QWinNativePanGestureRecognizer;
+};
+
+class QPinchGesturePrivate;
+class Q_GUI_EXPORT QPinchGesture : public QGesture
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QPinchGesture)
+
+public:
+ enum WhatChange {
+ ScaleFactorChanged = 0x1,
+ RotationAngleChanged = 0x2,
+ CenterPointChanged = 0x4
+ };
+ Q_DECLARE_FLAGS(WhatChanged, WhatChange)
+
+ Q_PROPERTY(WhatChanged whatChanged READ whatChanged WRITE setWhatChanged)
+
+ Q_PROPERTY(qreal totalScaleFactor READ totalScaleFactor WRITE setTotalScaleFactor)
+ Q_PROPERTY(qreal lastScaleFactor READ lastScaleFactor WRITE setLastScaleFactor)
+ Q_PROPERTY(qreal scaleFactor READ scaleFactor WRITE setScaleFactor)
+
+ Q_PROPERTY(qreal totalRotationAngle READ totalRotationAngle WRITE setTotalRotationAngle)
+ Q_PROPERTY(qreal lastRotationAngle READ lastRotationAngle WRITE setLastRotationAngle)
+ Q_PROPERTY(qreal rotationAngle READ rotationAngle WRITE setRotationAngle)
+
+ Q_PROPERTY(QPointF startCenterPoint READ startCenterPoint WRITE setStartCenterPoint)
+ Q_PROPERTY(QPointF lastCenterPoint READ lastCenterPoint WRITE setLastCenterPoint)
+ Q_PROPERTY(QPointF centerPoint READ centerPoint WRITE setCenterPoint)
+
+public:
+ QPinchGesture(QObject *parent = 0);
+
+ WhatChanged whatChanged() const;
+ void setWhatChanged(WhatChanged value);
+
+ QPointF startCenterPoint() const;
+ QPointF lastCenterPoint() const;
+ QPointF centerPoint() const;
+ void setStartCenterPoint(const QPointF &value);
+ void setLastCenterPoint(const QPointF &value);
+ void setCenterPoint(const QPointF &value);
+
+ qreal totalScaleFactor() const;
+ qreal lastScaleFactor() const;
+ qreal scaleFactor() const;
+ void setTotalScaleFactor(qreal value);
+ void setLastScaleFactor(qreal value);
+ void setScaleFactor(qreal value);
+
+ qreal totalRotationAngle() const;
+ qreal lastRotationAngle() const;
+ qreal rotationAngle() const;
+ void setTotalRotationAngle(qreal value);
+ void setLastRotationAngle(qreal value);
+ void setRotationAngle(qreal value);
+
+ friend class QPinchGestureRecognizer;
+};
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(QPinchGesture::WhatChanged)
+
+QT_BEGIN_NAMESPACE
+
+class QSwipeGesturePrivate;
+class Q_GUI_EXPORT QSwipeGesture : public QGesture
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QSwipeGesture)
+ Q_ENUMS(SwipeDirection)
+
+ Q_PROPERTY(SwipeDirection horizontalDirection READ horizontalDirection STORED false)
+ Q_PROPERTY(SwipeDirection verticalDirection READ verticalDirection STORED false)
+ Q_PROPERTY(qreal swipeAngle READ swipeAngle WRITE setSwipeAngle)
+
+public:
+ enum SwipeDirection { NoDirection, Left, Right, Up, Down };
+ QSwipeGesture(QObject *parent = 0);
+
+ SwipeDirection horizontalDirection() const;
+ SwipeDirection verticalDirection() const;
+
+ qreal swipeAngle() const;
+ void setSwipeAngle(qreal value);
+
+ friend class QSwipeGestureRecognizer;
};
QT_END_NAMESPACE