diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 80666b87d2..c2a698ef9b 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -645,12 +645,16 @@ QScreen *QWindow::screen() const void QWindow::setScreen(QScreen *newScreen) { Q_D(QWindow); - bool wasCreated = d->platformWindow != 0; - if (wasCreated) - destroy(); - d->screen = newScreen ? newScreen : QGuiApplication::primaryScreen(); - if (wasCreated) - create(); + if (!newScreen) + newScreen = QGuiApplication::primaryScreen(); + if (newScreen != screen()) { + const bool wasCreated = d->platformWindow != 0; + if (wasCreated) + destroy(); + d->screen = newScreen; + if (wasCreated) + create(); + } } /*! |