Adapt to OpenGL related Qt6 QQuickWindow API changes

This commit is contained in:
Volker Krause 2022-03-26 10:21:03 +01:00
parent 4009345e10
commit 95505eb044

View file

@ -27,6 +27,8 @@
#include <QOpenGLFramebufferObject>
#include <QTimer>
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <QQuickOpenGLUtils>
#include <QQuickRenderTarget>
#include <private/qeventpoint_p.h> // for QMutableEventPoint
#endif
@ -267,7 +269,11 @@ void OffscreenQuickView::update()
return;
}
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
d->m_view->setRenderTarget(d->m_fbo.data());
#else
d->m_view->setRenderTarget(QQuickRenderTarget::fromOpenGLTexture(d->m_fbo->texture(), d->m_fbo->size()));
#endif
}
d->m_renderControl->polishItems();
@ -275,7 +281,11 @@ void OffscreenQuickView::update()
d->m_renderControl->render();
if (usingGl) {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
d->m_view->resetOpenGLState();
#else
QQuickOpenGLUtils::resetOpenGLState();
#endif
}
if (d->m_useBlit) {