mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 20:58:38 +02:00
Merge pull request #12152 from gcalero/android_touchevents
Android touchevents
This commit is contained in:
commit
800b7963f2
2 changed files with 26 additions and 3 deletions
|
@ -498,14 +498,16 @@ TexturePointer Texture::build(const ktx::KTXDescriptor& descriptor) {
|
||||||
|
|
||||||
GPUKTXPayload gpuktxKeyValue;
|
GPUKTXPayload gpuktxKeyValue;
|
||||||
if (!GPUKTXPayload::findInKeyValues(descriptor.keyValues, gpuktxKeyValue)) {
|
if (!GPUKTXPayload::findInKeyValues(descriptor.keyValues, gpuktxKeyValue)) {
|
||||||
qCWarning(gpulogging) << "Could not find GPUKTX key values.";
|
#if defined(Q_OS_ANDROID)
|
||||||
// FIXME use sensible defaults based on the texture type and format
|
// FIXME use sensible defaults based on the texture type and format
|
||||||
gpuktxKeyValue._usageType = TextureUsageType::RESOURCE;
|
gpuktxKeyValue._usageType = TextureUsageType::RESOURCE;
|
||||||
gpuktxKeyValue._usage = Texture::Usage::Builder().withColor().withAlpha().build();
|
gpuktxKeyValue._usage = Texture::Usage::Builder().withColor().withAlpha().build();
|
||||||
|
#else
|
||||||
|
qCWarning(gpulogging) << "Could not find GPUKTX key values.";
|
||||||
|
return TexturePointer();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
auto texture = create(gpuktxKeyValue._usageType,
|
auto texture = create(gpuktxKeyValue._usageType,
|
||||||
type,
|
type,
|
||||||
texelFormat,
|
texelFormat,
|
||||||
|
|
|
@ -1097,6 +1097,27 @@ bool OffscreenQmlSurface::eventFilter(QObject* originalDestination, QEvent* even
|
||||||
}
|
}
|
||||||
break;
|
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:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue