From c2414e16aba2ad499a49d3661a2961795c9a9dc9 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 14 Jul 2016 12:43:46 +0200 Subject: Fix rendercontrol grabs with the software backend Calling grabWindow recurses (since that is implemented via QQuickRenderControl::grab...) so it's not an option. Instead, call directly in the software renderer implementation. Fix also the size of the offscreen QQuickWindow when using QQuickWidget in combination with the software backend. Change-Id: I857a2cc0aebbbaa5d52d809aeaec37c15b0787b9 Reviewed-by: Andy Nichols --- src/quickwidgets/qquickwidget.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/quickwidgets/qquickwidget.cpp') diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp index 2a014546e1..b25e2d348d 100644 --- a/src/quickwidgets/qquickwidget.cpp +++ b/src/quickwidgets/qquickwidget.cpp @@ -894,6 +894,12 @@ void QQuickWidget::createFramebufferObject() if (size().isEmpty()) return; + // Even though this is just an offscreen window we should set the position on it, as it might be + // useful for an item to know the actual position of the scene. + // Note: The position will be update when we get a move event (see: updatePosition()). + const QPoint &globalPos = mapToGlobal(QPoint(0, 0)); + d->offscreenWindow->setGeometry(globalPos.x(), globalPos.y(), width(), height()); + if (d->useSoftwareRenderer) { const QSize imageSize = size() * devicePixelRatio(); d->softwareImage = QImage(imageSize, QImage::Format_ARGB32_Premultiplied); @@ -961,11 +967,6 @@ void QQuickWidget::createFramebufferObject() } #endif - // Even though this is just an offscreen window we should set the position on it, as it might be - // useful for an item to know the actual position of the scene. - // Note: The position will be update when we get a move event (see: updatePosition()). - const QPoint &globalPos = mapToGlobal(QPoint(0, 0)); - d->offscreenWindow->setGeometry(globalPos.x(), globalPos.y(), width(), height()); d->offscreenWindow->setRenderTarget(d->fbo); if (samples > 0) -- cgit v1.2.3