mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-11-15 13:15:43 +08:00
Fixed restoreSideBar() function to prevent multiple side tabs for the same dock widget
This commit is contained in:
parent
d010fe7a95
commit
87f5b6127b
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user