From 93b9fdd391c7b19bb61b9b9ee2ba6bc3890af5ff Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 1 Feb 2024 20:47:59 +0200 Subject: [PATCH] effect: Fix initialization of QEvent::isAccepted() in cloned events in OffscreenQuickView QEvent::isAccepted() is initialized to true by default. BUG: 480538 --- src/effect/offscreenquickview.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/effect/offscreenquickview.cpp b/src/effect/offscreenquickview.cpp index 03d9960b2a..5c6b2168d1 100644 --- a/src/effect/offscreenquickview.cpp +++ b/src/effect/offscreenquickview.cpp @@ -273,6 +273,7 @@ void OffscreenQuickView::forwardMouseEvent(QEvent *e) QMouseEvent *me = static_cast(e); const QPoint widgetPos = d->m_view->mapFromGlobal(me->pos()); QMouseEvent cloneEvent(me->type(), widgetPos, me->pos(), me->button(), me->buttons(), me->modifiers()); + cloneEvent.setAccepted(false); QCoreApplication::sendEvent(d->m_view.get(), &cloneEvent); e->setAccepted(cloneEvent.isAccepted()); @@ -297,6 +298,7 @@ void OffscreenQuickView::forwardMouseEvent(QEvent *e) const QPointF widgetPos = d->m_view->mapFromGlobal(he->pos()); const QPointF oldWidgetPos = d->m_view->mapFromGlobal(he->oldPos()); QHoverEvent cloneEvent(he->type(), widgetPos, oldWidgetPos, he->modifiers()); + cloneEvent.setAccepted(false); QCoreApplication::sendEvent(d->m_view.get(), &cloneEvent); e->setAccepted(cloneEvent.isAccepted()); return; @@ -306,6 +308,7 @@ void OffscreenQuickView::forwardMouseEvent(QEvent *e) const QPointF widgetPos = d->m_view->mapFromGlobal(we->position().toPoint()); QWheelEvent cloneEvent(widgetPos, we->globalPosition(), we->pixelDelta(), we->angleDelta(), we->buttons(), we->modifiers(), we->phase(), we->inverted()); + cloneEvent.setAccepted(false); QCoreApplication::sendEvent(d->m_view.get(), &cloneEvent); e->setAccepted(cloneEvent.isAccepted()); return; @@ -329,6 +332,7 @@ bool OffscreenQuickView::forwardTouchDown(qint32 id, const QPointF &pos, std::ch QTouchEvent event(QEvent::TouchBegin, d->touchDevice, Qt::NoModifier, d->touchPoints); event.setTimestamp(std::chrono::duration_cast(time).count()); + event.setAccepted(false); QCoreApplication::sendEvent(d->m_view.get(), &event); return event.isAccepted(); @@ -340,6 +344,7 @@ bool OffscreenQuickView::forwardTouchMotion(qint32 id, const QPointF &pos, std:: QTouchEvent event(QEvent::TouchUpdate, d->touchDevice, Qt::NoModifier, d->touchPoints); event.setTimestamp(std::chrono::duration_cast(time).count()); + event.setAccepted(false); QCoreApplication::sendEvent(d->m_view.get(), &event); return event.isAccepted(); @@ -351,6 +356,7 @@ bool OffscreenQuickView::forwardTouchUp(qint32 id, std::chrono::microseconds tim QTouchEvent event(QEvent::TouchEnd, d->touchDevice, Qt::NoModifier, d->touchPoints); event.setTimestamp(std::chrono::duration_cast(time).count()); + event.setAccepted(false); QCoreApplication::sendEvent(d->m_view.get(), &event); return event.isAccepted();