From 8e7b7f536e93953c42cca03d2ee2b044e8a06260 Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Wed, 9 Nov 2022 11:15:42 +0100 Subject: [PATCH] Fixed CAutoHideDockContainer::addDockWidget to prevent OldDockArea->removeDockWidget(DockWidget) call when restoring state --- src/AutoHideDockContainer.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/AutoHideDockContainer.cpp b/src/AutoHideDockContainer.cpp index 6a09fdb..208ee07 100644 --- a/src/AutoHideDockContainer.cpp +++ b/src/AutoHideDockContainer.cpp @@ -339,22 +339,16 @@ void CAutoHideDockContainer::addDockWidget(CDockWidget* DockWidget) d->DockWidget = DockWidget; d->SideTab->setDockWidget(DockWidget); CDockAreaWidget* OldDockArea = DockWidget->dockAreaWidget(); - if (OldDockArea) + auto IsRestoringState = DockWidget->dockManager()->isRestoringState(); + if (OldDockArea && !IsRestoringState) { - OldDockArea->removeDockWidget(DockWidget); - } - d->DockArea->addDockWidget(DockWidget); - - // Prevent overriding of d->Size parameter when this function is called during - // state restoring - if (!DockWidget->dockManager()->isRestoringState() && OldDockArea) - { // The initial size should be a little bit bigger than the original dock // area size to prevent that the resize handle of this auto hid dock area // is near of the splitter of the old dock area. d->Size = OldDockArea->size() + QSize(16, 16); - } - + OldDockArea->removeDockWidget(DockWidget); + } + d->DockArea->addDockWidget(DockWidget); updateSize(); }