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 11:23:36 +0000 |
commit | 947d77f7af7207517e0cec690a5914df5f083a34 (patch) | |
tree | 338b86656171f662a0f5adf293b98a65f46a5093 | |
parent | 7cb18b0223eefbda1ad8b5f8fb67817237c2c4f2 (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 1f163b9d7..ec4049c6a 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 |