diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2011-10-21 15:45:25 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-10-22 20:50:37 +0200 |
commit | 4a788eb8313d7c089e3a59594fc6a5c9a7dd6499 (patch) | |
tree | ea627aad2e78a98861c5f1861a24941daca3475c /src/gui/kernel | |
parent | 68dc5b90c04058ff8d940c093528effa80ac7e4a (diff) |
QWindow: Re-create platform window only if screen actually changes.
Change-Id: I3b7dd8b1307aa3cc9357dca861ea407644c5a2e9
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src/gui/kernel')
-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(); + } } /*! |