Skip to content

Commit 0d243a8

Browse files
committed
Fix wrong grabbing behavior
QQuickWidget::grabFrameBuffer() was not polishing its items nor syncing the scene graph compared to standard QQuickWindow::grabWindow(). This lead to QQuickWidget grabbed content to be outdated (render the previous frame as a new frame). Task-number: QTBUG-57596 Change-Id: I94f5e0aa5b096fb9e21259267c0e50473e8ed5bd Reviewed-by: Robin Burchell <robin.burchell@viroteck.net> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
1 parent 7b7322c commit 0d243a8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/quick/items/qquickrendercontrol.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,9 @@ QImage QQuickRenderControl::grab()
380380

381381
if (d->window->rendererInterface()->graphicsApi() == QSGRendererInterface::OpenGL) {
382382
#if QT_CONFIG(opengl)
383+
QQuickWindowPrivate *cd = QQuickWindowPrivate::get(d->window);
384+
cd->polishItems();
385+
cd->syncSceneGraph();
383386
render();
384387
grabContent = qt_gl_read_framebuffer(d->window->size() * d->window->effectiveDevicePixelRatio(), false, false);
385388
#endif
@@ -394,6 +397,8 @@ QImage QQuickRenderControl::grab()
394397
QPaintDevice *prevDev = softwareRenderer->currentPaintDevice();
395398
softwareRenderer->setCurrentPaintDevice(&grabContent);
396399
softwareRenderer->markDirty();
400+
cd->polishItems();
401+
cd->syncSceneGraph();
397402
render();
398403
softwareRenderer->setCurrentPaintDevice(prevDev);
399404
}

0 commit comments

Comments
 (0)