From 4f3b5fab382a14d93a5712252312c56715b9aad3 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 26 Jul 2016 15:09:53 +0200 Subject: QWidgetPrivate::setWindowFlags(): Fix checking for changes in Qt::Window Store the result of the comparison before the calling QWidget::setParent() passing the flags which can modify q->data->window_flags. Previously, this led to the condition triggering when a child window was becoming top level, causing the geometry to be changed (notably for fullscreen windows on Windows, where fullscreen is merely emulated). Amends change 5e99b07a072bedee239ed6980a44719da9ffa7c9. Task-number: QTBUG-54906 Change-Id: I9369d7d9f886451cfdb933746a4572593ffa074a Reviewed-by: Andy Shaw --- src/widgets/kernel/qwidget.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 6729969024..b1d80d7b8f 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -10340,14 +10340,13 @@ void QWidgetPrivate::setWindowFlags(Qt::WindowFlags flags) // the old type was a window and/or the new type is a window QPoint oldPos = q->pos(); bool visible = q->isVisible(); + const bool windowFlagChanged = (q->data->window_flags ^ flags) & Qt::Window; q->setParent(q->parentWidget(), flags); // if both types are windows or neither of them are, we restore // the old position - if (!((q->data->window_flags ^ flags) & Qt::Window) - && (visible || q->testAttribute(Qt::WA_Moved))) { + if (!windowFlagChanged && (visible || q->testAttribute(Qt::WA_Moved))) q->move(oldPos); - } // for backward-compatibility we change Qt::WA_QuitOnClose attribute value only when the window was recreated. adjustQuitOnCloseAttribute(); } else { -- cgit v1.2.3