diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-05-14 08:55:04 (GMT) |
---|---|---|
committer | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-05-18 13:21:25 (GMT) |
commit | ac8e33994455200c369d8aa9d1853b618c225058 (patch) | |
tree | e46879fd41c7bdcefc41b6f0ba25c7f0703623f3 /src/gui/graphicsview/qgraphicsproxywidget.cpp | |
parent | 8f1724f5b3b09f57e260518f644ebc002b065443 (diff) | |
download | Qt-ac8e33994455200c369d8aa9d1853b618c225058.zip Qt-ac8e33994455200c369d8aa9d1853b618c225058.tar.gz Qt-ac8e33994455200c369d8aa9d1853b618c225058.tar.bz2 |
implemented gestures support in graphicsview for QGraphicsItems and
QGraphicsProxyWidgets.
This is still work-in-progress.
Diffstat (limited to 'src/gui/graphicsview/qgraphicsproxywidget.cpp')
-rw-r--r-- | src/gui/graphicsview/qgraphicsproxywidget.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/gui/graphicsview/qgraphicsproxywidget.cpp b/src/gui/graphicsview/qgraphicsproxywidget.cpp index 01b7593..2d7490c 100644 --- a/src/gui/graphicsview/qgraphicsproxywidget.cpp +++ b/src/gui/graphicsview/qgraphicsproxywidget.cpp @@ -48,6 +48,7 @@ #include "private/qgraphicsproxywidget_p.h" #include "private/qwidget_p.h" #include "private/qapplication_p.h" +#include "private/qgesturemanager_p.h" #include <QtCore/qdebug.h> #include <QtGui/qevent.h> @@ -275,7 +276,7 @@ void QGraphicsProxyWidgetPrivate::sendWidgetMouseEvent(QGraphicsSceneMouseEvent QWidget *embeddedMouseGrabberPtr = (QWidget *)embeddedMouseGrabber; QApplicationPrivate::sendMouseEvent(receiver, mouseEvent, alienWidget, widget, - &embeddedMouseGrabberPtr, lastWidgetUnderMouse); + &embeddedMouseGrabberPtr, lastWidgetUnderMouse, event->spontaneous()); embeddedMouseGrabber = embeddedMouseGrabberPtr; // Handle enter/leave events when last button is released from mouse @@ -648,6 +649,9 @@ void QGraphicsProxyWidgetPrivate::setWidget_helper(QWidget *newWidget, bool auto q->setAttribute(Qt::WA_OpaquePaintEvent); widget = newWidget; + foreach(int gestureId, widget->d_func()->gestures) { + grabGesture(gestureId); + } // Changes only go from the widget to the proxy. enabledChangeMode = QGraphicsProxyWidgetPrivate::WidgetToProxyMode; @@ -871,6 +875,16 @@ bool QGraphicsProxyWidget::event(QEvent *event) } break; } + case QEvent::GraphicsSceneGesture: { + qDebug() << "QGraphicsProxyWidget: graphicsscenegesture"; + if (d->widget && d->widget->isVisible()) { + QGraphicsSceneGestureEvent *ge = static_cast<QGraphicsSceneGestureEvent*>(event); + //### TODO: widget->childAt(): decompose gesture event and find widget under hotspots. + QGestureManager::instance()->sendGestureEvent(d->widget, ge->gestures().toSet(), ge->cancelledGestures()); + return true; + } + break; + } default: break; } |