summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-10-28 20:40:14 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-11-03 10:26:06 (GMT)
commitcfcfae65778f2e1e7fc3936c66689e3685f1cc77 (patch)
tree728c38f0e9603e174e0d6391ab50542693ed2191 /src/gui/graphicsview
parent4843b437b90800d238f14e7a4558045ddc37cd4b (diff)
downloadQt-cfcfae65778f2e1e7fc3936c66689e3685f1cc77.zip
Qt-cfcfae65778f2e1e7fc3936c66689e3685f1cc77.tar.gz
Qt-cfcfae65778f2e1e7fc3936c66689e3685f1cc77.tar.bz2
Modified gesture events propagation.
By default if the gesture is ignored, only gestures in the started state are propagated, and accepting a gesture in the started state adds an implicit grab meaning all the following events in the gesture sequence will be delivered to that widget. This is similar to the way QTouchEvent is propagated. Also added a hint, which specifies if gestures in any state can be propagated to the widget which has enabled the hint. Reviewed-by: Thomas Zander
Diffstat (limited to 'src/gui/graphicsview')
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 9279fe3..f5bb408 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -5900,7 +5900,12 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event)
QGraphicsItemPrivate *gid = item->QGraphicsItem::d_func();
foreach(QGesture *g, alreadyIgnoredGestures) {
- if (gid->gestureContext.contains(g->gestureType()))
+ QMap<Qt::GestureType, Qt::GestureContext>::iterator contextit =
+ gid->gestureContext.find(g->gestureType());
+ bool deliver = contextit != gid->gestureContext.end() &&
+ (g->state() == Qt::GestureStarted ||
+ (contextit.value() & Qt::GestureContextHint_Mask) & Qt::AcceptPartialGesturesHint);
+ if (deliver)
gestures += g;
}
if (gestures.isEmpty())
@@ -5913,8 +5918,12 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event)
sendEvent(item, &ev);
QSet<QGesture *> ignoredGestures;
foreach (QGesture *g, gestures) {
- if (!ev.isAccepted() && !ev.isAccepted(g))
+ if (!ev.isAccepted() && !ev.isAccepted(g)) {
ignoredGestures.insert(g);
+ } else {
+ if (g->state() == Qt::GestureStarted)
+ gestureTargets[g] = item;
+ }
}
if (!ignoredGestures.isEmpty()) {
// get a list of items under the (current) hotspot of each ignored