Revert "effects: Use unique device for replaying events to QQuickView"

It broke overview.

This reverts commit 862dae455a.
This commit is contained in:
Vlad Zahorodnii 2024-05-27 19:08:44 +03:00
parent 447994581b
commit a76ae07ee1

View file

@ -271,15 +271,13 @@ void OffscreenQuickView::forwardMouseEvent(QEvent *e)
if (!d->m_visible) {
return;
}
auto replayDevice = QPointingDevice::primaryPointingDevice("mouseReplayDevice");
switch (e->type()) {
case QEvent::MouseMove:
case QEvent::MouseButtonPress:
case QEvent::MouseButtonRelease: {
QMouseEvent *me = static_cast<QMouseEvent *>(e);
const QPoint widgetPos = d->m_view->mapFromGlobal(me->pos());
QMouseEvent cloneEvent(me->type(), widgetPos, me->pos(), me->button(), me->buttons(), me->modifiers(), replayDevice);
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());
@ -291,7 +289,7 @@ void OffscreenQuickView::forwardMouseEvent(QEvent *e)
d->lastMousePressButton = me->button();
if (doubleClick) {
d->lastMousePressButton = Qt::NoButton;
QMouseEvent doubleClickEvent(QEvent::MouseButtonDblClick, me->localPos(), me->windowPos(), me->screenPos(), me->button(), me->buttons(), me->modifiers(), replayDevice);
QMouseEvent doubleClickEvent(QEvent::MouseButtonDblClick, me->localPos(), me->windowPos(), me->screenPos(), me->button(), me->buttons(), me->modifiers());
QCoreApplication::sendEvent(d->m_view.get(), &doubleClickEvent);
}
}
@ -314,7 +312,7 @@ void OffscreenQuickView::forwardMouseEvent(QEvent *e)
QWheelEvent *we = static_cast<QWheelEvent *>(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(), Qt::MouseEventNotSynthesized, replayDevice);
we->modifiers(), we->phase(), we->inverted());
cloneEvent.setAccepted(false);
QCoreApplication::sendEvent(d->m_view.get(), &cloneEvent);
e->setAccepted(cloneEvent.isAccepted());