diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-03-12 15:07:36 (GMT) |
---|---|---|
committer | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-05-11 13:49:16 (GMT) |
commit | 3e2cef8f6a58949b887add8ff1bb5e457e7be542 (patch) | |
tree | b1f34bff7d54fe94a0e1599650a94b71a892f9ef /src/gui/graphicsview/qgraphicssceneevent.h | |
parent | ed24f677a411c449a2a3f862906aff2a313b4425 (diff) | |
download | Qt-3e2cef8f6a58949b887add8ff1bb5e457e7be542.zip Qt-3e2cef8f6a58949b887add8ff1bb5e457e7be542.tar.gz Qt-3e2cef8f6a58949b887add8ff1bb5e457e7be542.tar.bz2 |
Added QGraphicsSceneGestureEvent that extends plain QGestureEvent by
providing some additional info (like a widget that received a gesture
- for coordinates conversions).
Diffstat (limited to 'src/gui/graphicsview/qgraphicssceneevent.h')
-rw-r--r-- | src/gui/graphicsview/qgraphicssceneevent.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/gui/graphicsview/qgraphicssceneevent.h b/src/gui/graphicsview/qgraphicssceneevent.h index 8ae3a99..d3899cd 100644 --- a/src/gui/graphicsview/qgraphicssceneevent.h +++ b/src/gui/graphicsview/qgraphicssceneevent.h @@ -44,6 +44,11 @@ #include <QtCore/qcoreevent.h> #include <QtCore/qpoint.h> +#include <QtCore/qrect.h> +#include <QtGui/qpolygon.h> +#include <QtCore/qset.h> +#include <QtCore/qhash.h> +#include <QtCore/qsharedpointer.h> QT_BEGIN_HEADER @@ -302,6 +307,41 @@ public: void setNewPos(const QPointF &pos); }; +class QGesture; +class QGraphicsItem; +class QGraphicsSceneGestureEventPrivate; +class Q_GUI_EXPORT QGraphicsSceneGestureEvent : public QGraphicsSceneEvent +{ + Q_DECLARE_PRIVATE(QGraphicsSceneGestureEvent) +public: + QGraphicsSceneGestureEvent(); + ~QGraphicsSceneGestureEvent(); + + inline bool contains(const Qt::GestureType &type) const + { return gesture(type) != 0; } + inline QList<Qt::GestureType> gestureTypes() const + { return m_gestures.keys(); } + inline const QGesture* gesture(const Qt::GestureType &type) const + { return m_gestures.value(type, QSharedPointer<QGesture>()).data(); } + inline QList<QSharedPointer<QGesture> > gestures() const + { return m_gestures.values(); } + void setGestures(const QList<QSharedPointer<QGesture> > &gestures); + + inline QSet<Qt::GestureType> cancelledGestures() const + { return m_cancelledGestures; } + void setCancelledGestures(const QSet<Qt::GestureType> &cancelledGestures) + { m_cancelledGestures = cancelledGestures; } + + QPointF mapToScene(const QPoint &point) const; + QPolygonF mapToScene(const QRect &rect) const; + QPointF mapToItem(const QPoint &point, QGraphicsItem *item) const; + QPolygonF mapToItem(const QRect &rect, QGraphicsItem *item) const; + +protected: + QHash<Qt::GestureType, QSharedPointer<QGesture> > m_gestures; + QSet<Qt::GestureType> m_cancelledGestures; +}; + class QGraphicsSceneTouchEventPrivate; class QGraphicsSceneTouchEventTouchPointPrivate; class Q_GUI_EXPORT QGraphicsSceneTouchEvent : public QGraphicsSceneEvent |