aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/quickwidgets/qquickwidget.cpp9
-rw-r--r--tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp3
2 files changed, 7 insertions, 5 deletions
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp
index f1a0f0c863..b63f7de9f1 100644
--- a/src/quickwidgets/qquickwidget.cpp
+++ b/src/quickwidgets/qquickwidget.cpp
@@ -1314,9 +1314,13 @@ void QQuickWidget::mouseDoubleClickEvent(QMouseEvent *e)
void QQuickWidget::showEvent(QShowEvent *)
{
Q_D(QQuickWidget);
+ bool shouldTriggerUpdate = true;
+
if (!d->useSoftwareRenderer) {
d->createContext();
+
if (d->offscreenWindow->openglContext()) {
+ shouldTriggerUpdate = false;
d->render(true);
// render() may have led to a QQuickWindow::update() call (for
// example, having a scene with a QQuickFramebufferObject::Renderer
@@ -1329,11 +1333,12 @@ void QQuickWidget::showEvent(QShowEvent *)
d->updatePending = false;
update();
}
- } else {
- triggerUpdate();
}
}
+ if (shouldTriggerUpdate)
+ triggerUpdate();
+
// note offscreenWindow is "QQuickOffScreenWindow" instance
d->offscreenWindow->setVisible(true);
if (QQmlInspectorService *service = QQmlDebugConnector::service<QQmlInspectorService>())
diff --git a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp
index fd5c3653ad..691dfd1bc6 100644
--- a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp
+++ b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp
@@ -449,9 +449,6 @@ void tst_qquickwidget::reparentToNewWindow()
qqw->setParent(&window2);
qqw->show();
- if (QGuiApplication::platformName() == QLatin1String("offscreen"))
- QEXPECT_FAIL("", "afterRendering not emitted after reparenting on offscreen", Continue);
-
QTRY_VERIFY(afterRenderingSpy.size() > 0);
QImage img = qqw->grabFramebuffer();