From 7c22e6435cd4b9f16ec8b48dee77119ea8673ec8 Mon Sep 17 00:00:00 2001 From: Volker Krause Date: Sun, 24 Apr 2022 18:21:48 +0200 Subject: [PATCH] Adapt to Qt6 QQuickRenderControl API changes --- src/libkwineffects/kwinoffscreenquickview.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/libkwineffects/kwinoffscreenquickview.cpp b/src/libkwineffects/kwinoffscreenquickview.cpp index e9f11b48d0..1258f102f9 100644 --- a/src/libkwineffects/kwinoffscreenquickview.cpp +++ b/src/libkwineffects/kwinoffscreenquickview.cpp @@ -27,6 +27,7 @@ #include #include #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +#include #include #include #include // for QMutableEventPoint @@ -146,7 +147,11 @@ OffscreenQuickView::OffscreenQuickView(QObject *parent, QWindow *renderWindow, E if (!usingGl) { qCDebug(LIBKWINEFFECTS) << "QtQuick Software rendering mode detected"; d->m_useBlit = true; +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) d->m_renderControl->initialize(nullptr); +#else + d->m_renderControl->initialize(); +#endif } else { QSurfaceFormat format; format.setOption(QSurfaceFormat::ResetNotification); @@ -165,7 +170,12 @@ OffscreenQuickView::OffscreenQuickView(QObject *parent, QWindow *renderWindow, E d->m_offscreenSurface->create(); d->m_glcontext->makeCurrent(d->m_offscreenSurface.get()); +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) d->m_renderControl->initialize(d->m_glcontext.get()); +#else + d->m_view->setGraphicsDevice(QQuickGraphicsDevice::fromOpenGLContext(d->m_glcontext.get())); + d->m_renderControl->initialize(); +#endif d->m_glcontext->doneCurrent(); // On Wayland, contexts are implicitly shared and QOpenGLContext::globalShareContext() is null. @@ -295,7 +305,11 @@ void OffscreenQuickView::update() } if (d->m_useBlit) { +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) d->m_image = d->m_renderControl->grab(); +#else + d->m_image = d->m_view->grabWindow(); +#endif } if (usingGl) {