diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2016-07-26 15:09:53 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2016-08-25 12:05:55 +0000 |
commit | 4f3b5fab382a14d93a5712252312c56715b9aad3 (patch) | |
tree | 7845071ba6b93dea071364f4157c1e848707c110 | |
parent | 1e6630b54ce9a005c2cffac4dac95641838e8231 (diff) |
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 <andy.shaw@qt.io>
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 5 |
1 files 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 { |