diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.cpp b/src/widgets/graphicsview/qgraphicsproxywidget.cpp index 9a577455a60..4ffc06c5134 100644 --- a/src/widgets/graphicsview/qgraphicsproxywidget.cpp +++ b/src/widgets/graphicsview/qgraphicsproxywidget.cpp @@ -922,13 +922,14 @@ bool QGraphicsProxyWidget::event(QEvent *event) case QEvent::TouchBegin: case QEvent::TouchUpdate: case QEvent::TouchEnd: { - QTouchEvent *touchEvent = static_cast(event); - auto touchPoints = touchEvent->points(); - bool res = QApplicationPrivate::translateRawTouchEvent(d->widget, touchEvent); - if (res) { - event->accept(); + if (event->spontaneous()) + qt_sendSpontaneousEvent(d->widget, event); + else + QCoreApplication::sendEvent(d->widget, event); + + if (event->isAccepted()) return true; - } + break; } default: diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 6dba04d284b..4c704f39468 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -4020,9 +4020,7 @@ bool QApplicationPrivate::translateRawTouchEvent(QWidget *window, const QTouchEv { // if the TouchBegin handler recurses, we assume that means the event // has been implicitly accepted and continue to send touch events - bool res = te->spontaneous() ? QApplication::sendSpontaneousEvent(widget, &touchEvent) - : QApplication::sendEvent(widget, &touchEvent); - if (res && touchEvent.isAccepted()) { + if (QApplication::sendSpontaneousEvent(widget, &touchEvent) && touchEvent.isAccepted()) { accepted = true; if (!widget.isNull()) widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent); @@ -4035,9 +4033,7 @@ bool QApplicationPrivate::translateRawTouchEvent(QWidget *window, const QTouchEv || QGestureManager::gesturePending(widget) #endif ) { - bool res = te->spontaneous() ? QApplication::sendSpontaneousEvent(widget, &touchEvent) - : QApplication::sendEvent(widget, &touchEvent); - if (res && touchEvent.isAccepted()) + if (QApplication::sendSpontaneousEvent(widget, &touchEvent) && touchEvent.isAccepted()) accepted = true; // widget can be deleted on TouchEnd if (touchEvent.type() == QEvent::TouchEnd && !widget.isNull()) diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index 4bd0dd0a8cc..a2c7a6bf4bd 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -3782,8 +3782,6 @@ void tst_QGraphicsProxyWidget::wheelEventPropagation() // QTBUG_45737 void tst_QGraphicsProxyWidget::forwardTouchEvent() { - QSKIP("Test is currently broken"); - QGraphicsScene scene; TouchWidget *widget = new TouchWidget; @@ -3931,6 +3929,7 @@ void tst_QGraphicsProxyWidget::touchEventPropagation() sequence.press(0, pushButton1->pos() + pb1Center + formProxy->pos().toPoint()); } // ..., formProxy, pushButton1, formWidget + QEXPECT_FAIL("", "Touch events are not forwarded to children - QTBUG-67819", Abort); QCOMPARE(eventSpy.count(), 6); record = eventSpy.at(eventSpy.count() - 2); QCOMPARE(record.receiver, pushButton1);