summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-05-11 10:18:08 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-05-11 14:52:06 (GMT)
commitfd55642d60b852fbd175a9ea7c1a2457c6f611aa (patch)
treef488aa9592f6a8c1a4b49d42937016e509a59748
parent81a64345258f2f2ad5cf77355f7ecbd3ebad9734 (diff)
downloadQt-fd55642d60b852fbd175a9ea7c1a2457c6f611aa.zip
Qt-fd55642d60b852fbd175a9ea7c1a2457c6f611aa.tar.gz
Qt-fd55642d60b852fbd175a9ea7c1a2457c6f611aa.tar.bz2
Added accept* method to QGraphicsSceneGestureEvent as well.
-rw-r--r--src/gui/graphicsview/qgraphicssceneevent.cpp48
-rw-r--r--src/gui/graphicsview/qgraphicssceneevent.h9
2 files changed, 57 insertions, 0 deletions
diff --git a/src/gui/graphicsview/qgraphicssceneevent.cpp b/src/gui/graphicsview/qgraphicssceneevent.cpp
index 86825b1..9795fda 100644
--- a/src/gui/graphicsview/qgraphicssceneevent.cpp
+++ b/src/gui/graphicsview/qgraphicssceneevent.cpp
@@ -1890,6 +1890,54 @@ void QGraphicsSceneGestureEvent::setGestures(const QList<QGesture*> &gestures)
m_gestures.insert(g->type(), g);
}
+/*!
+ Sets the accept flag of the all gestures inside the event object,
+ the equivalent of calling \l{QEvent::accept()}{accept()} or
+ \l{QEvent::setAccepted()}{setAccepted(true)}.
+
+ Setting the accept parameter indicates that the event receiver
+ wants the gesture. Unwanted gestures might be propagated to the parent
+ widget.
+*/
+void QGraphicsSceneGestureEvent::acceptAll()
+{
+ QHash<QString, QGesture*>::iterator it = m_gestures.begin(),
+ e = m_gestures.end();
+ for(; it != e; ++it)
+ it.value()->accept();
+ setAccepted(true);
+}
+
+/*!
+ Sets the accept flag of the specified gesture inside the event
+ object, the equivalent of calling
+ \l{QGestureEvent::gesture()}{gesture(type)}->\l{QGesture::accept()}{accept()}
+
+ Setting the accept parameter indicates that the event receiver
+ wants the gesture. Unwanted gestures might be propagated to the parent
+ widget.
+*/
+void QGraphicsSceneGestureEvent::accept(Qt::GestureType type)
+{
+ if (QGesture *g = m_gestures.value(qt_getStandardGestureTypeName(type), 0))
+ g->accept();
+}
+
+/*!
+ Sets the accept flag of the specified gesture inside the event
+ object, the equivalent of calling
+ \l{QGestureEvent::gesture()}{gesture(type)}->\l{QGesture::accept()}{accept()}
+
+ Setting the accept parameter indicates that the event receiver
+ wants the gesture. Unwanted gestures might be propagated to the parent
+ widget.
+*/
+void QGraphicsSceneGestureEvent::accept(const QString &type)
+{
+ if (QGesture *g = m_gestures.value(type, 0))
+ g->accept();
+}
+
class QGraphicsSceneTouchEventPrivate : public QGraphicsSceneEventPrivate
{
Q_DECLARE_PUBLIC(QGraphicsSceneTouchEvent)
diff --git a/src/gui/graphicsview/qgraphicssceneevent.h b/src/gui/graphicsview/qgraphicssceneevent.h
index 244c25e..4b7065e 100644
--- a/src/gui/graphicsview/qgraphicssceneevent.h
+++ b/src/gui/graphicsview/qgraphicssceneevent.h
@@ -329,6 +329,15 @@ public:
QSet<QString> cancelledGestures() const;
void setCancelledGestures(const QSet<QString> &cancelledGestures);
+ void acceptAll();
+#ifndef Q_NO_USING_KEYWORD
+ using QEvent::accept;
+#else
+ inline void accept() { QEvent::accept(); }
+#endif
+ void accept(Qt::GestureType type);
+ void accept(const QString &type);
+
QPointF mapToScene(const QPoint &point) const;
QPolygonF mapToScene(const QRect &rect) const;
QPointF mapToItem(const QPoint &point, QGraphicsItem *item) const;