summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2012-11-29 16:25:59 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-11-30 18:28:10 +0100
commit27a945dccd7dbe6449427f85c8ebdca7b0f654f8 (patch)
tree51ab3658a4646280af50c9197d10b8751cd5ecac
parent6385a182f0f93820c96cf274e50a56492491ee10 (diff)
Restore the visibility of a moved QWindow in QWindow::screenDestroyed
QWindow::screenDestroyed triggers an move of the window to the primary screen. This causes the screen to be destroyed and shown again on the new QScreen. The issue is that QWindow::destroy() hides the window but create() doesn't set it visible, and this ultimately causes any QWindow to be automatically hidden when their QScreen is destroyed. As stated in the comment, it could be the intended behavior that windows aren't shown automatically on a remaining screen like when using two screens not logically part of the same desktop. Once the platform plugins have access to an API allowing them to adjust the screens of their QWindow, this patch shouldn't be needed anymore. Change-Id: I7628377c969f79f9eebb3deabaf0470542d68a9c Reviewed-by: Samuel Rødal <samuel.rodal@digia.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
-rw-r--r--src/gui/kernel/qwindow.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 24ba92fe8d..c24609e886 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -1388,8 +1388,16 @@ void QWindow::setScreen(QScreen *newScreen)
void QWindow::screenDestroyed(QObject *object)
{
Q_D(QWindow);
- if (object == static_cast<QObject *>(d->screen))
+ if (object == static_cast<QObject *>(d->screen)) {
+ const bool wasVisible = isVisible();
setScreen(0);
+ // destroy() might have hidden our window, show it again.
+ // This might not be the best behavior if the new screen isn't a virtual sibling
+ // of the old one. This can be removed once platform plugins have the power to
+ // update the QScreen of its QWindows itself.
+ if (wasVisible && d->platformWindow)
+ setVisible(true);
+ }
}
/*!