diff options
Diffstat (limited to 'src/widgets/kernel/qapplication.cpp')
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 02fcfde59e..d036f6bada 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -3837,7 +3837,7 @@ bool QApplicationPrivate::translateTouchToMouse(QWidget *widget, QTouchEvent *ev return false; } -void QApplicationPrivate::translateRawTouchEvent(QWidget *window, +bool QApplicationPrivate::translateRawTouchEvent(QWidget *window, QTouchDevice *device, const QList<QTouchEvent::TouchPoint> &touchPoints, ulong timestamp) @@ -3899,8 +3899,9 @@ void QApplicationPrivate::translateRawTouchEvent(QWidget *window, } if (widgetsNeedingEvents.isEmpty()) - return; + return false; + bool accepted = false; QHash<QWidget *, StatesAndTouchPoints>::ConstIterator it = widgetsNeedingEvents.constBegin(); const QHash<QWidget *, StatesAndTouchPoints>::ConstIterator end = widgetsNeedingEvents.constEnd(); for (; it != end; ++it) { @@ -3939,19 +3940,23 @@ void QApplicationPrivate::translateRawTouchEvent(QWidget *window, { // if the TouchBegin handler recurses, we assume that means the event // has been implicitly accepted and continue to send touch events - widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent); - (void ) QApplication::sendSpontaneousEvent(widget, &touchEvent); + if (QApplication::sendSpontaneousEvent(widget, &touchEvent) && touchEvent.isAccepted()) { + accepted = true; + widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent); + } break; } default: if (widget->testAttribute(Qt::WA_WState_AcceptedTouchBeginEvent)) { if (touchEvent.type() == QEvent::TouchEnd) widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent, false); - (void) QApplication::sendSpontaneousEvent(widget, &touchEvent); + if (QApplication::sendSpontaneousEvent(widget, &touchEvent) && touchEvent.isAccepted()) + accepted = true; } break; } } + return accepted; } void QApplicationPrivate::translateTouchCancel(QTouchDevice *device, ulong timestamp) |