Skip to content

Commit 8e7b7f5

Browse files
Fixed CAutoHideDockContainer::addDockWidget to prevent OldDockArea->removeDockWidget(DockWidget) call when restoring state
1 parent 38dfd51 commit 8e7b7f5

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

src/AutoHideDockContainer.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -339,22 +339,16 @@ void CAutoHideDockContainer::addDockWidget(CDockWidget* DockWidget)
339339
d->DockWidget = DockWidget;
340340
d->SideTab->setDockWidget(DockWidget);
341341
CDockAreaWidget* OldDockArea = DockWidget->dockAreaWidget();
342-
if (OldDockArea)
342+
auto IsRestoringState = DockWidget->dockManager()->isRestoringState();
343+
if (OldDockArea && !IsRestoringState)
343344
{
344-
OldDockArea->removeDockWidget(DockWidget);
345-
}
346-
d->DockArea->addDockWidget(DockWidget);
347-
348-
// Prevent overriding of d->Size parameter when this function is called during
349-
// state restoring
350-
if (!DockWidget->dockManager()->isRestoringState() && OldDockArea)
351-
{
352345
// The initial size should be a little bit bigger than the original dock
353346
// area size to prevent that the resize handle of this auto hid dock area
354347
// is near of the splitter of the old dock area.
355348
d->Size = OldDockArea->size() + QSize(16, 16);
356-
}
357-
349+
OldDockArea->removeDockWidget(DockWidget);
350+
}
351+
d->DockArea->addDockWidget(DockWidget);
358352
updateSize();
359353
}
360354

0 commit comments

Comments
 (0)