aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@digia.com>2014-08-26 16:13:27 +0200
committerLaszlo Agocs <laszlo.agocs@digia.com>2014-08-27 13:40:18 +0200
commit1b7eb341a408732f4561e07f77694ee2fb118d50 (patch)
treedff503f333b9de21fa64f1e704de037301220562
parent5e254fc9fa32f9639fd8fb0e2bb23d08073c2231 (diff)
Fix not having a context when making a QQuickWidget visible again
If we hit the size-is-zero path, the condition that got recently introduced (if fakeHidden && d->context) is not really sufficient. It could be that d->context is valid but the scenegraph is invalidated (i.e. offscreenWindow->openglContext() is null). This case has to be handled the same way. Therefore, the function is now simplified to perform polish & sync in one place. Task-number: QTBUG-40794 Change-Id: Ia54f25fbdc199a0b88501a2d89edb5cee5411972 Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
-rw-r--r--src/quickwidgets/qquickwidget.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp
index 27b26d1d67..e85b0fe2e0 100644
--- a/src/quickwidgets/qquickwidget.cpp
+++ b/src/quickwidgets/qquickwidget.cpp
@@ -882,26 +882,27 @@ void QQuickWidget::resizeEvent(QResizeEvent *e)
d->fakeHidden = true;
return;
}
- if (d->fakeHidden && d->context) {
+
+ bool needsSync = false;
+ if (d->fakeHidden) {
//restart rendering
d->fakeHidden = false;
- d->renderControl->sync();
+ needsSync = true;
}
- bool newFbo = false;
if (d->context) {
// Bail out in the special case of receiving a resize after
// scenegraph invalidation during application exit.
if (!d->fbo && !d->offscreenWindow->openglContext())
return;
if (!d->fbo || d->fbo->size() != size() * devicePixelRatio()) {
- newFbo = true;
+ needsSync = true;
createFramebufferObject();
}
} else {
// This will result in a scenegraphInitialized() signal which
// is connected to createFramebufferObject().
- newFbo = true;
+ needsSync = true;
d->createContext();
}
@@ -916,13 +917,10 @@ void QQuickWidget::resizeEvent(QResizeEvent *e)
context->makeCurrent(d->offscreenSurface);
- if (newFbo) {
+ if (needsSync) {
d->renderControl->polishItems();
d->renderControl->sync();
- } else if (d->fakeHidden) {
- d->renderControl->sync();
}
- d->fakeHidden = false;
d->renderControl->render();
context->functions()->glFlush();