diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-06-28 08:48:00 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-06-30 12:23:37 +0000 |
commit | facb48c37d31412362a42b6ea3910e953fc8494a (patch) | |
tree | e79209e2b653bbf6abb49e8186e0033012623ef5 | |
parent | 698a92bc828847889b5615377eecf6f38eb1fe44 (diff) |
Qt Designer: Fix assert when switching from Top Level Mode to Docked
Destroy the native windows when switching to neutral mode, preventing
unneded native children and an assert:
ASSERT: "window == topLevelWindow || topLevelWindow->isAncestorOf(window, QWindow::ExcludeTransients)" in file src/gui/painting/qbackingstore.cpp, line 228
Aborted (core dumped)
Change-Id: Ib614014c604de540daca9faf4927749b03cdd90c
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit da47685f73241cc4209ba3c66ec72a7472532f6a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/designer/src/designer/qdesigner_workbench.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/designer/src/designer/qdesigner_workbench.cpp b/src/designer/src/designer/qdesigner_workbench.cpp index 5cd5883e9..929925eab 100644 --- a/src/designer/src/designer/qdesigner_workbench.cpp +++ b/src/designer/src/designer/qdesigner_workbench.cpp @@ -61,6 +61,7 @@ #include <QtGui/qactiongroup.h> #include <QtGui/qevent.h> #include <QtGui/qscreen.h> +#include <QtGui/qwindow.h> #include <QtCore/qdir.h> #include <QtCore/qfile.h> @@ -371,6 +372,9 @@ void QDesignerWorkbench::switchToNeutralMode() for (QDesignerToolWindow *tw : qAsConst(m_toolWindows)) { tw->setCloseEventPolicy(MainWindowBase::AcceptCloseEvents); tw->setParent(nullptr); + // Prevent unneeded native children when switching to docked + if (auto *handle = tw->windowHandle()) + handle->destroy(); } if (m_dockedMainWindow != nullptr) // Prevent assert @@ -379,6 +383,9 @@ void QDesignerWorkbench::switchToNeutralMode() for (QDesignerFormWindow *fw : qAsConst(m_formWindows)) { fw->setParent(nullptr); fw->setMaximumSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); + // Prevent unneeded native children when switching to docked + if (auto *handle = fw->windowHandle()) + handle->destroy(); } #ifndef Q_OS_MACOS |