Fixed restoreSideBar() function to prevent multiple side tabs for the same dock widget

This commit is contained in:
Uwe Kindler 2022-11-11 16:33:12 +01:00
parent d010fe7a95
commit 87f5b6127b
2 changed files with 18 additions and 3 deletions

View File

@ -40,6 +40,7 @@ class CDockWidget;
class CAutoHideSideBar;
class CDockWidgetTab;
struct SideTabIconLabelPrivate;
struct DockContainerWidgetPrivate;
/**
* A dock widget Side tab that shows a title or an icon.
@ -60,12 +61,13 @@ private:
friend struct AutoHideTabPrivate;
friend class CDockWidget;
friend class CAutoHideDockContainer;
protected:
friend class CAutoHideSideBar;
friend class CDockAreaWidget;
friend class CDockContainerWidget;
friend DockContainerWidgetPrivate;
protected:
void setSideBar(CAutoHideSideBar *SideTabBar);
void removeFromSideBar();
virtual bool event(QEvent* event) override;

View File

@ -1104,7 +1104,20 @@ bool DockContainerWidgetPrivate::restoreSideBar(CDockingStateReader& s,
}
auto SideBar = _this->sideTabBar(Area);
auto AutoHideContainer = SideBar->insertDockWidget(-1, DockWidget);
CAutoHideDockContainer* AutoHideContainer;
if (DockWidget->isAutoHide())
{
AutoHideContainer = DockWidget->autoHideDockContainer();
if (AutoHideContainer->sideBar() != SideBar)
{
AutoHideContainer->autoHideTab()->removeFromSideBar();
SideBar->insertTab(-1, AutoHideContainer->autoHideTab());
}
}
else
{
AutoHideContainer = SideBar->insertDockWidget(-1, DockWidget);
}
AutoHideContainer->setSize(Size);
DockWidget->setProperty(internal::ClosedProperty, Closed);
DockWidget->setProperty(internal::DirtyProperty, false);