diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-02-10 15:57:11 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-02-13 18:30:06 +0000 |
commit | 09e7a994d14a0582912551ca1342e3b695cf3a86 (patch) | |
tree | 1b1cb309115db137e6c14b2ffcee19774ad6f8a9 /src/gui/kernel/qwindow.cpp | |
parent | 9bf8cc1f185d3d39446a6911f4a694f274bb94c3 (diff) |
Don't create platform window for QWindows when calling setVisible(false)
We can defer the creation until the window is shown.
Change-Id: I3d5b45ae59ee0925996cf12cd46dd574c8c6ef95
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/gui/kernel/qwindow.cpp')
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 47277abea3..6092b08ea1 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -532,7 +532,9 @@ void QWindow::setVisible(bool visible) // can defer creation until the parent is created or we're re-parented. if (parent() && !parent()->handle()) return; - else + + // We only need to create the window if it's being shown + if (visible) create(); } @@ -574,7 +576,8 @@ void QWindow::setVisible(bool visible) d->applyCursor(); #endif - d->platformWindow->setVisible(visible); + if (d->platformWindow) + d->platformWindow->setVisible(visible); if (!visible) { QHideEvent hideEvent; |