diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-03-16 15:31:05 (GMT) |
---|---|---|
committer | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-05-11 14:51:38 (GMT) |
commit | 841b10d10943d912fe75674045a740cff29e266c (patch) | |
tree | 3589271276898f1b53391d1d4eb1bb7f25b90331 /src | |
parent | 31d90932bd52d2557a9f1b164632e879105ce67b (diff) | |
download | Qt-841b10d10943d912fe75674045a740cff29e266c.zip Qt-841b10d10943d912fe75674045a740cff29e266c.tar.gz Qt-841b10d10943d912fe75674045a740cff29e266c.tar.bz2 |
Removed QWidget::gestureEvent() functions since adding a new virtual
function breaks binary compatibility.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/graphicsview/qgraphicsscene.cpp | 68 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicsscene.h | 1 | ||||
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 7 | ||||
-rw-r--r-- | src/gui/kernel/qwidget.h | 2 |
4 files changed, 33 insertions, 45 deletions
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 0f70cfe..337b6ee 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -3951,8 +3951,38 @@ bool QGraphicsScene::event(QEvent *event) // geometries that do not have an explicit style set. update(); break; - case QEvent::GraphicsSceneGesture: - gestureEvent(static_cast<QGraphicsSceneGestureEvent*>(event)); + case QEvent::GraphicsSceneGesture: { + QGraphicsSceneGestureEvent *ev = static_cast<QGraphicsSceneGestureEvent*>(event); + QList<QString> gestureTypes = ev->gestureTypes(); + QGraphicsView *view = qobject_cast<QGraphicsView*>(ev->widget()); + if (!view) { + qWarning("QGraphicsScene::event: gesture event was received without a view"); + break; + } + + // find graphics items that intersects with gestures hot spots. + QPolygonF poly; + QMap<int, QPointF> sceneHotSpots; + foreach(const QString &type, gestureTypes) { + QPointF pt = ev->mapToScene(ev->gesture(type)->hotSpot()); + sceneHotSpots.insert(qHash(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(); + 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; + } + } + } + } break; case QEvent::GraphicsSceneTouchBegin: d->touchBeginEvent(static_cast<QGraphicsSceneTouchEvent *>(event)); @@ -5604,40 +5634,6 @@ void QGraphicsScenePrivate::removeView(QGraphicsView *view) view->releaseGesture(gestureId); } -void QGraphicsScene::gestureEvent(QGraphicsSceneGestureEvent *event) -{ - Q_D(QGraphicsScene); - QList<QString> gestureTypes = event->gestureTypes(); - QGraphicsView *view = qobject_cast<QGraphicsView*>(event->widget()); - if (!view) { - qWarning("QGraphicsScene::gestureEvent: gesture event was received without a view"); - return; - } - - // find graphics items that intersects with gestures hot spots. - QPolygonF poly; - QMap<int, QPointF> sceneHotSpots; - foreach(const QString &type, gestureTypes) { - QPointF pt = event->mapToScene(event->gesture(type)->hotSpot()); - sceneHotSpots.insert(qHash(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(); - for(; it != e; ++it) { - if (item->contains(item->mapFromScene(it.value())) && - item->d_ptr->gestures.contains(it.key())) { - d->sendEvent(item, event); - if (event->isAccepted()) - break; - } - } - } -} - void QGraphicsScenePrivate::grabGesture(QGraphicsItem *item, int gestureId) { if (!grabbedGestures.contains(gestureId)) { diff --git a/src/gui/graphicsview/qgraphicsscene.h b/src/gui/graphicsview/qgraphicsscene.h index 45def44..a76b348 100644 --- a/src/gui/graphicsview/qgraphicsscene.h +++ b/src/gui/graphicsview/qgraphicsscene.h @@ -256,7 +256,6 @@ protected: virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); virtual void wheelEvent(QGraphicsSceneWheelEvent *event); virtual void inputMethodEvent(QInputMethodEvent *event); - virtual void gestureEvent(QGraphicsSceneGestureEvent *event); virtual void drawBackground(QPainter *painter, const QRectF &rect); virtual void drawForeground(QPainter *painter, const QRectF &rect); diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 9c0c404..0029809 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -7931,7 +7931,7 @@ bool QWidget::event(QEvent *event) break; #endif case QEvent::Gesture: - gestureEvent((QGestureEvent*)event); + event->ignore(); break; #ifndef QT_NO_PROPERTIES case QEvent::DynamicPropertyChange: { @@ -8738,11 +8738,6 @@ bool QWidget::qwsEvent(QWSEvent *) #endif -void QWidget::gestureEvent(QGestureEvent *event) -{ - event->ignore(); -} - /*! Ensures that the widget has been polished by QStyle (i.e., has a diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h index 6324782..80d4f3e 100644 --- a/src/gui/kernel/qwidget.h +++ b/src/gui/kernel/qwidget.h @@ -677,8 +677,6 @@ protected: // Misc. protected functions virtual void changeEvent(QEvent *); - virtual void gestureEvent(QGestureEvent *); - int metric(PaintDeviceMetric) const; virtual void inputMethodEvent(QInputMethodEvent *); |