From b5fbe9ad3924c935c5e382eed23786cabb10c240 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Mon, 13 May 2024 12:54:24 +0500 Subject: [PATCH] Fix quickwidgets with qt 6.7 --- plugins/quickinspector/quickscreengrabber.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/plugins/quickinspector/quickscreengrabber.cpp b/plugins/quickinspector/quickscreengrabber.cpp index b704190e87..c48033a5e9 100644 --- a/plugins/quickinspector/quickscreengrabber.cpp +++ b/plugins/quickinspector/quickscreengrabber.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #ifndef QT_NO_OPENGL #include @@ -626,10 +627,21 @@ void OpenGLScreenGrabber::windowAfterRendering() // to find the right x,y offsets to extract and show just our quick widget const bool isQQuickWidget = qstrcmp(m_window->metaObject()->className(), "QQuickWidgetOffscreenWindow") == 0; if (isQQuickWidget) { +#if QT_VERSION <= QT_VERSION_CHECK(6, 6, 0) xOff = m_renderInfo.windowPosition.x(); const auto windowBottom = (m_renderInfo.windowPosition.y() + m_renderInfo.windowSize.height()); const auto viewportHeight = viewport[3]; yOff = viewportHeight - windowBottom; +#else + const auto windowBottom = m_renderInfo.windowSize.height(); + const auto rc = QQuickWindowPrivate::get(m_window)->renderControl; + QPoint offset; + rc->renderWindow(&offset); + + const auto viewportHeight = viewport[3]; + yOff = viewportHeight - windowBottom - offset.y(); + xOff = offset.x(); +#endif } #endif