Fixed restoreSideBar function and dropping floating widget with auto hide widgets

This commit is contained in:
Uwe Kindler 2022-11-15 14:21:24 +01:00
parent 7b9f9e10e5
commit 260a2ddb24
3 changed files with 12 additions and 9 deletions

View File

@ -303,7 +303,8 @@ CAutoHideDockContainer::~CAutoHideDockContainer()
//============================================================================ //============================================================================
CAutoHideSideBar* CAutoHideDockContainer::sideBar() const CAutoHideSideBar* CAutoHideDockContainer::sideBar() const
{ {
return dockContainer()->sideTabBar(d->SideTabBarArea); auto DockContainer = dockContainer();
return DockContainer ? DockContainer->sideTabBar(d->SideTabBarArea) : nullptr;
} }

View File

@ -1110,8 +1110,7 @@ bool DockContainerWidgetPrivate::restoreSideBar(CDockingStateReader& s,
AutoHideContainer = DockWidget->autoHideDockContainer(); AutoHideContainer = DockWidget->autoHideDockContainer();
if (AutoHideContainer->sideBar() != SideBar) if (AutoHideContainer->sideBar() != SideBar)
{ {
AutoHideContainer->autoHideTab()->removeFromSideBar(); SideBar->addAutoHideWidget(AutoHideContainer);
SideBar->insertTab(-1, AutoHideContainer->autoHideTab());
} }
} }
else else
@ -1637,12 +1636,6 @@ void CDockContainerWidget::dropFloatingWidget(CFloatingDockContainer* FloatingWi
auto ContainerDropArea = d->DockManager->containerOverlay()->dropAreaUnderCursor(); auto ContainerDropArea = d->DockManager->containerOverlay()->dropAreaUnderCursor();
bool Dropped = false; bool Dropped = false;
auto autoHideWidgets = FloatingWidget->dockContainer()->autoHideWidgets();
for (const auto autohideWidget : autoHideWidgets)
{
createAndSetupAutoHideContainer(autohideWidget->sideBarLocation(), autohideWidget->dockWidget());
}
if (DockArea) if (DockArea)
{ {
auto dropOverlay = d->DockManager->dockAreaOverlay(); auto dropOverlay = d->DockManager->dockAreaOverlay();
@ -1674,6 +1667,14 @@ void CDockContainerWidget::dropFloatingWidget(CFloatingDockContainer* FloatingWi
} }
} }
// Remove the auto hide widgets from the FloatingWidget and insert
// them into this widget
for (auto AutohideWidget : FloatingWidget->dockContainer()->autoHideWidgets())
{
auto SideBar = sideTabBar(AutohideWidget->sideBarLocation());
SideBar->addAutoHideWidget(AutohideWidget);
}
if (Dropped) if (Dropped)
{ {
// Fix https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/issues/351 // Fix https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/issues/351

View File

@ -83,6 +83,7 @@ private:
friend CAutoHideTab; friend CAutoHideTab;
friend AutoHideTabPrivate; friend AutoHideTabPrivate;
friend AutoHideDockContainerPrivate; friend AutoHideDockContainerPrivate;
friend CAutoHideSideBar;
protected: protected:
/** /**