aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickwidgets
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2015-06-04 10:24:46 +0200
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2015-06-04 10:28:48 +0200
commit9556f6d075b61fa95d6e1057f305e522a26f71d6 (patch)
tree53190472453390810c47b9b5a47b23188a00267e /src/quickwidgets
parent42ffe9b193a5bd958b0853233fd0d94170722bd1 (diff)
parent1fd0cdc6a2e01775d8a79c6614910cc5a2fbf2b3 (diff)
Merge remote-tracking branch 'origin/5.5' into dev
Conflicts: src/qml/jsruntime/qv4engine_p.h src/quick/items/qquickitemsmodule.cpp src/quick/items/qquicktext.cpp src/quick/util/qquickpixmapcache.cpp tests/auto/quick/qquickwindow/tst_qquickwindow.cpp Change-Id: I90ecaad6a4bfaa4f36149a7463f4d7141f4a516a
Diffstat (limited to 'src/quickwidgets')
-rw-r--r--src/quickwidgets/qquickwidget.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp
index 5dd439fdd0..1afea402fd 100644
--- a/src/quickwidgets/qquickwidget.cpp
+++ b/src/quickwidgets/qquickwidget.cpp
@@ -698,8 +698,10 @@ void QQuickWidgetPrivate::createContext()
context = new QOpenGLContext;
context->setFormat(offscreenWindow->requestedFormat());
- if (qt_gl_global_share_context())
+ if (qt_gl_global_share_context()) {
context->setShareContext(qt_gl_global_share_context());
+ context->setScreen(context->shareContext()->screen());
+ }
if (!context->create()) {
const bool isEs = context->isOpenGLES();
@@ -714,6 +716,7 @@ void QQuickWidgetPrivate::createContext()
// contains a QSurfaceFormat representing the _actual_ format of the underlying
// configuration. This is essential to get a surface that is compatible with the context.
offscreenSurface->setFormat(context->format());
+ offscreenSurface->setScreen(context->screen());
offscreenSurface->create();
}
@@ -749,7 +752,14 @@ void QQuickWidget::createFramebufferObject()
if (context->shareContext() != QWidgetPrivate::get(window())->shareContext()) {
context->setShareContext(QWidgetPrivate::get(window())->shareContext());
- context->create();
+ context->setScreen(context->shareContext()->screen());
+ if (!context->create())
+ qWarning("QQuickWidget: Failed to recreate context");
+ // The screen may be different so we must recreate the offscreen surface too.
+ // Unlike QOpenGLContext, QOffscreenSurface's create() does not recreate so have to destroy() first.
+ d->offscreenSurface->destroy();
+ d->offscreenSurface->setScreen(context->screen());
+ d->offscreenSurface->create();
}
context->makeCurrent(d->offscreenSurface);
@@ -1063,7 +1073,7 @@ void QQuickWidget::showEvent(QShowEvent *)
Q_D(QQuickWidget);
d->updatePending = false;
d->createContext();
- triggerUpdate();
+ d->render(true);
}
/*! \reimp */