summaryrefslogtreecommitdiffstats
path: root/src/widgets/graphicsview/qgraphicsproxywidget.cpp
diff options
context:
space:
mode:
authorRafael Roquetto <rafael.roquetto@kdab.com>2015-09-03 16:53:53 +0000
committerRafael Roquetto <rafael.roquetto@kdab.com>2015-09-22 20:54:44 +0000
commitf5b682d320401dd82c37cee0b2e400966460e37c (patch)
tree4a0240315bbcc3f726a8e3baecc6a96522825bfb /src/widgets/graphicsview/qgraphicsproxywidget.cpp
parent24d0f9ef5aa81390fc315fccae616191a88c26d9 (diff)
QGraphicsProxyWidget: forward touch events to QWidget
When working with QGraphicsView/QGraphicsScene, touch events are sent to QGraphicsView's viewport() event handler, which then dispatches it to the corresponding QGraphicsItem, if any. In the case of QGraphicsProxyWidget, we need to forward these touch events to the encapsulated QWidget, otherwise it will never receive them (i.e. the event chain for touch events terminates at QGraphicsProxyWidget). This also enables QWidgets associated with QGraphicsProxyWidget to grab gestures. Task-id: QTBUG-45737 Change-Id: Ia441d3576afb6c97376be6f2ff073901e6e928a5 Reviewed-by: Andreas Aardal Hanssen <andreas@hanssen.name>
Diffstat (limited to 'src/widgets/graphicsview/qgraphicsproxywidget.cpp')
-rw-r--r--src/widgets/graphicsview/qgraphicsproxywidget.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.cpp b/src/widgets/graphicsview/qgraphicsproxywidget.cpp
index 08ea1ea0e3..edb0f4e0ff 100644
--- a/src/widgets/graphicsview/qgraphicsproxywidget.cpp
+++ b/src/widgets/graphicsview/qgraphicsproxywidget.cpp
@@ -879,6 +879,19 @@ bool QGraphicsProxyWidget::event(QEvent *event)
break;
}
#endif
+ case QEvent::TouchBegin:
+ case QEvent::TouchUpdate:
+ case QEvent::TouchEnd: {
+ if (event->spontaneous())
+ qt_sendSpontaneousEvent(d->widget, event);
+ else
+ QApplication::sendEvent(d->widget, event);
+
+ if (event->isAccepted())
+ return true;
+
+ break;
+ }
default:
break;
}