mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-13 22:27:13 +02:00
Propagate touch events to qml offscreen surface
This commit is contained in:
parent
9fa06e0019
commit
c469e8ce53
1 changed files with 21 additions and 0 deletions
|
@ -1097,6 +1097,27 @@ bool OffscreenQmlSurface::eventFilter(QObject* originalDestination, QEvent* even
|
|||
}
|
||||
break;
|
||||
}
|
||||
#if defined(Q_OS_ANDROID)
|
||||
case QEvent::TouchBegin:
|
||||
case QEvent::TouchUpdate:
|
||||
case QEvent::TouchEnd: {
|
||||
QTouchEvent *originalEvent = static_cast<QTouchEvent *>(event);
|
||||
QTouchEvent *fakeEvent = new QTouchEvent(*originalEvent);
|
||||
auto newTouchPoints = fakeEvent->touchPoints();
|
||||
for (size_t i = 0; i < newTouchPoints.size(); ++i) {
|
||||
const auto &originalPoint = originalEvent->touchPoints()[i];
|
||||
auto &newPoint = newTouchPoints[i];
|
||||
newPoint.setPos(originalPoint.pos());
|
||||
}
|
||||
fakeEvent->setTouchPoints(newTouchPoints);
|
||||
if (QCoreApplication::sendEvent(_quickWindow, fakeEvent)) {
|
||||
qInfo() << __FUNCTION__ << "sent fake touch event:" << fakeEvent->type()
|
||||
<< "_quickWindow handled it... accepted:" << fakeEvent->isAccepted();
|
||||
return false; //event->isAccepted();
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue