Skip to content

Commit

Permalink
Fix quickwidgets with qt 6.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Waqar144 committed May 13, 2024
1 parent dcb6af6 commit b5fbe9a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions plugins/quickinspector/quickscreengrabber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <QEvent>
#include <QPainter>
#include <QQuickWindow>
#include <QQuickRenderControl>

#ifndef QT_NO_OPENGL
#include <QOpenGLContext>
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit b5fbe9a

Please sign in to comment.