diff options
-rw-r--r-- | src/gui/graphicsview/qgraphicssceneevent.cpp | 69 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicssceneevent.h | 22 | ||||
-rw-r--r-- | src/gui/kernel/qevent.cpp | 37 | ||||
-rw-r--r-- | src/gui/kernel/qevent.h | 22 |
4 files changed, 110 insertions, 40 deletions
diff --git a/src/gui/graphicsview/qgraphicssceneevent.cpp b/src/gui/graphicsview/qgraphicssceneevent.cpp index 4d9e7bb..4f24a74 100644 --- a/src/gui/graphicsview/qgraphicssceneevent.cpp +++ b/src/gui/graphicsview/qgraphicssceneevent.cpp @@ -304,6 +304,8 @@ QT_BEGIN_NAMESPACE +QString qt_getStandardGestureTypeName(Qt::GestureType type); + class QGraphicsSceneEventPrivate { public: @@ -1725,45 +1727,80 @@ void QGraphicsSceneMoveEvent::setNewPos(const QPointF &pos) gestures with \l{QGraphicsItem::}{grabGesture()}. */ -/*! \fn bool QGraphicsSceneGestureEvent::contains(const Qt::GestureType &type) const +QGraphicsSceneGestureEvent::QGraphicsSceneGestureEvent() + : QGraphicsSceneEvent(QEvent::GraphicsSceneGesture) +{ +} + +QGraphicsSceneGestureEvent::~QGraphicsSceneGestureEvent() +{ +} + +/*! Checks if the gesture event contains gesture of specific \a type. */ +bool QGraphicsSceneGestureEvent::contains(const QString &type) const +{ + return gesture(type) != 0; +} -/*! \fn QList<Qt::GestureType> QGraphicsSceneGestureEvent::gestureTypes() const +/*! + Checks if the gesture event contains gesture of specific \a type. +*/ +bool QGraphicsSceneGestureEvent::contains(Qt::GestureType type) const +{ + return contains(qt_getStandardGestureTypeName(type)); +} +/*! Returns a list of gesture names that the event contains. */ +QList<QString> QGraphicsSceneGestureEvent::gestureTypes() const +{ + return m_gestures.keys(); +} -/*! \fn const QGesture* QGraphicsSceneGestureEvent::gesture(const Qt::GestureType &type) const - +/*! Returns extended information about a gesture of specific \a type. */ +const QGesture* QGraphicsSceneGestureEvent::gesture(const QString &type) const +{ + return m_gestures.value(type, QSharedPointer<QGesture>()).data(); +} -/*! \fn QList<QSharedPointer<QGesture> > QGraphicsSceneGestureEvent::gestures() const +/*! + Returns extended information about a gesture of specific \a type. +*/ +const QGesture* QGraphicsSceneGestureEvent::gesture(Qt::GestureType type) const +{ + return gesture(qt_getStandardGestureTypeName(type)); +} +/*! Returns extended information about all triggered gestures. */ +QList<QSharedPointer<QGesture> > QGraphicsSceneGestureEvent::gestures() const +{ + return m_gestures.values(); +} -/*! \fn QSet<Qt::GestureType> QGraphicsSceneGestureEvent::cancelledGestures() const - +/*! Returns a set of gesture names that used to be executed, but got cancelled (i.e. they were not finished properly). */ +QSet<QString> QGraphicsSceneGestureEvent::cancelledGestures() const +{ + return m_cancelledGestures; +} -/*! \fn void QGraphicsSceneGestureEvent::setCancelledGestures(const QSet<Qt::GestureType> &) - +/*! Returns a set of gesture names that used to be executed, but got cancelled (i.e. they were not finished properly). */ - -QGraphicsSceneGestureEvent::QGraphicsSceneGestureEvent() - : QGraphicsSceneEvent(QEvent::GraphicsSceneGesture) -{ -} - -QGraphicsSceneGestureEvent::~QGraphicsSceneGestureEvent() +void QGraphicsSceneGestureEvent::setCancelledGestures(const QSet<QString> &cancelledGestures) { + m_cancelledGestures = cancelledGestures; } /*! diff --git a/src/gui/graphicsview/qgraphicssceneevent.h b/src/gui/graphicsview/qgraphicssceneevent.h index 4d88cda..d1a301e 100644 --- a/src/gui/graphicsview/qgraphicssceneevent.h +++ b/src/gui/graphicsview/qgraphicssceneevent.h @@ -317,20 +317,18 @@ public: QGraphicsSceneGestureEvent(); ~QGraphicsSceneGestureEvent(); - inline bool contains(const QString &type) const - { return gesture(type) != 0; } - inline QList<QString> gestureTypes() const - { return m_gestures.keys(); } - inline const QGesture* gesture(const QString &type) const - { return m_gestures.value(type, QSharedPointer<QGesture>()).data(); } - inline QList<QSharedPointer<QGesture> > gestures() const - { return m_gestures.values(); } + bool contains(const QString &type) const; + bool contains(Qt::GestureType type) const; + + QList<QString> gestureTypes() const; + + const QGesture* gesture(Qt::GestureType type) const; + const QGesture* gesture(const QString &type) const; + QList<QSharedPointer<QGesture> > gestures() const; void setGestures(const QList<QSharedPointer<QGesture> > &gestures); - inline QSet<QString> cancelledGestures() const - { return m_cancelledGestures; } - void setCancelledGestures(const QSet<QString> &cancelledGestures) - { m_cancelledGestures = cancelledGestures; } + QSet<QString> cancelledGestures() const; + void setCancelledGestures(const QSet<QString> &cancelledGestures); QPointF mapToScene(const QPoint &point) const; QPolygonF mapToScene(const QRect &rect) const; diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 225d8b1..5761939 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -52,6 +52,8 @@ QT_BEGIN_NAMESPACE +QString qt_getStandardGestureTypeName(Qt::GestureType type); + /*! \class QInputEvent \ingroup events @@ -3572,6 +3574,41 @@ QGestureEvent::~QGestureEvent() { } +bool QGestureEvent::contains(Qt::GestureType type) const +{ + return contains(qt_getStandardGestureTypeName(type)); +} + +bool QGestureEvent::contains(const QString &type) const +{ + return gesture(type) != 0; +} + +QList<QString> QGestureEvent::gestureTypes() const +{ + return m_gestures.keys(); +} + +const QGesture* QGestureEvent::gesture(Qt::GestureType type) const +{ + return gesture(qt_getStandardGestureTypeName(type)); +} + +const QGesture* QGestureEvent::gesture(const QString &type) const +{ + return m_gestures.value(type, QSharedPointer<QGesture>()).data(); +} + +QList<QSharedPointer<QGesture> > QGestureEvent::gestures() const +{ + return m_gestures.values(); +} + +QSet<QString> QGestureEvent::cancelledGestures() const +{ + return m_cancelledGestures; +} + /*! \class QTouchEvent \brief The QTouchEvent class contains parameters that describe a touch event . diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index db3d03f..48e420a 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -723,18 +723,16 @@ public: QGestureEvent(const QGestureEvent &gestures, const QPoint &offset); ~QGestureEvent(); - inline bool contains(const QString &type) const - { return gesture(type) != 0; } - inline QList<QString> gestureTypes() const - { return m_gestures.keys(); } - - inline const QGesture* gesture(const QString &type) const - { return m_gestures.value(type, QSharedPointer<QGesture>()).data(); } - inline QList<QSharedPointer<QGesture> > gestures() const - { return m_gestures.values(); } - - inline QSet<QString> cancelledGestures() const - { return m_cancelledGestures; } + bool contains(Qt::GestureType type) const; + bool contains(const QString &type) const; + + QList<QString> gestureTypes() const; + + const QGesture* gesture(Qt::GestureType type) const; + const QGesture* gesture(const QString &type) const; + QList<QSharedPointer<QGesture> > gestures() const; + + QSet<QString> cancelledGestures() const; protected: QHash<QString, QSharedPointer<QGesture> > m_gestures; |