aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickwidgets
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@qt.io>2016-06-20 13:48:12 +0200
committerMorten Johan Sørvig <morten.sorvig@qt.io>2016-06-20 20:42:55 +0000
commitc15fea6691485501547449e5f78725d3b6f1c968 (patch)
tree1bcbf2c622af1f4633c82f253dfed3b095943132 /src/quickwidgets
parent3cd46501b2a663c7cb20cae21b4ed051f2ce4ac7 (diff)
QQuickWidget: Propagate screen changes.
This is required to make Qt Quick pick up changes to the devicePixelRatio. Failure to do so prevents a proper update of text nodes, as seen in the Qt Creator welcome screen. Propagate the new screen to the offscreenWindow, offscreenSurface and context. [ChangeLog][QtQuick] QQuickWidget now properly repaints text on high-DPI screen changes. Change-Id: I8f0b9f2f8768f99e293de018ae56d50ddf20b43a Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/quickwidgets')
-rw-r--r--src/quickwidgets/qquickwidget.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp
index 1a840b44bd..6709d88fa3 100644
--- a/src/quickwidgets/qquickwidget.cpp
+++ b/src/quickwidgets/qquickwidget.cpp
@@ -1217,6 +1217,17 @@ bool QQuickWidget::event(QEvent *e)
break;
case QEvent::ScreenChangeInternal:
+ if (QWindow *window = this->window()->windowHandle()) {
+ QScreen *newScreen = window->screen();
+
+ if (d->offscreenWindow)
+ d->offscreenWindow->setScreen(newScreen);
+ if (d->offscreenSurface)
+ d->offscreenSurface->setScreen(newScreen);
+ if (d->context)
+ d->context->setScreen(newScreen);
+ }
+
if (d->fbo) {
// This will check the size taking the devicePixelRatio into account
// and recreate if needed.