diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-04-27 11:15:59 (GMT) |
---|---|---|
committer | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-05-11 14:51:59 (GMT) |
commit | b3dbea5da34edb28a007ea7796de30204021a902 (patch) | |
tree | 08f6d0b3c19260f3d147dedb9704803940edb248 /src | |
parent | 66faa6f11f78b5fa4f3da52e74d6ef501bb19ca5 (diff) | |
download | Qt-b3dbea5da34edb28a007ea7796de30204021a902.zip Qt-b3dbea5da34edb28a007ea7796de30204021a902.tar.gz Qt-b3dbea5da34edb28a007ea7796de30204021a902.tar.bz2 |
Fixed gesture event propagation to QGraphicsItems.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/graphicsview/qgraphicsscene.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 337b6ee..7bac21c 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -247,6 +247,7 @@ static const int QGRAPHICSSCENE_INDEXTIMER_TIMEOUT = 2000; #ifdef Q_WS_X11 #include <private/qt_x11_p.h> #endif +#include <private/qgesturemanager_p.h> QT_BEGIN_NAMESPACE @@ -3962,23 +3963,27 @@ bool QGraphicsScene::event(QEvent *event) // find graphics items that intersects with gestures hot spots. QPolygonF poly; - QMap<int, QPointF> sceneHotSpots; + QMap<QString, QPointF> sceneHotSpots; foreach(const QString &type, gestureTypes) { QPointF pt = ev->mapToScene(ev->gesture(type)->hotSpot()); - sceneHotSpots.insert(qHash(type), pt); + sceneHotSpots.insert(type, pt); poly << pt; } QList<QGraphicsItem*> itemsInGestureArea = items(poly, Qt::IntersectsItemBoundingRect); foreach(QGraphicsItem *item, itemsInGestureArea) { - QMap<int, QPointF>::const_iterator it = sceneHotSpots.begin(), - e = sceneHotSpots.end(); + QMap<QString, QPointF>::const_iterator it = sceneHotSpots.begin(), + e = sceneHotSpots.end(); for(; it != e; ++it) { - if (item->contains(item->mapFromScene(it.value())) && - item->d_ptr->gestures.contains(it.key())) { - d->sendEvent(item, ev); - if (ev->isAccepted()) - break; + if (item->contains(item->mapFromScene(it.value()))) { + const QString gestureName = it.key(); + foreach(int gestureId, item->d_ptr->gestures) { + if (QGestureManager::instance()->gestureNameFromId(gestureId) == gestureName) { + d->sendEvent(item, ev); + if (ev->isAccepted()) + break; + } + } } } } |