diff --git a/src/AutoHideDockContainer.cpp b/src/AutoHideDockContainer.cpp index 4471ff6..a9d6a28 100644 --- a/src/AutoHideDockContainer.cpp +++ b/src/AutoHideDockContainer.cpp @@ -303,7 +303,8 @@ CAutoHideDockContainer::~CAutoHideDockContainer() //============================================================================ CAutoHideSideBar* CAutoHideDockContainer::sideBar() const { - return dockContainer()->sideTabBar(d->SideTabBarArea); + auto DockContainer = dockContainer(); + return DockContainer ? DockContainer->sideTabBar(d->SideTabBarArea) : nullptr; } diff --git a/src/DockContainerWidget.cpp b/src/DockContainerWidget.cpp index c29acc1..1612894 100644 --- a/src/DockContainerWidget.cpp +++ b/src/DockContainerWidget.cpp @@ -1110,8 +1110,7 @@ bool DockContainerWidgetPrivate::restoreSideBar(CDockingStateReader& s, AutoHideContainer = DockWidget->autoHideDockContainer(); if (AutoHideContainer->sideBar() != SideBar) { - AutoHideContainer->autoHideTab()->removeFromSideBar(); - SideBar->insertTab(-1, AutoHideContainer->autoHideTab()); + SideBar->addAutoHideWidget(AutoHideContainer); } } else @@ -1637,12 +1636,6 @@ void CDockContainerWidget::dropFloatingWidget(CFloatingDockContainer* FloatingWi auto ContainerDropArea = d->DockManager->containerOverlay()->dropAreaUnderCursor(); bool Dropped = false; - auto autoHideWidgets = FloatingWidget->dockContainer()->autoHideWidgets(); - for (const auto autohideWidget : autoHideWidgets) - { - createAndSetupAutoHideContainer(autohideWidget->sideBarLocation(), autohideWidget->dockWidget()); - } - if (DockArea) { 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) { // Fix https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/issues/351 diff --git a/src/DockContainerWidget.h b/src/DockContainerWidget.h index 852615a..f360b52 100644 --- a/src/DockContainerWidget.h +++ b/src/DockContainerWidget.h @@ -83,6 +83,7 @@ private: friend CAutoHideTab; friend AutoHideTabPrivate; friend AutoHideDockContainerPrivate; + friend CAutoHideSideBar; protected: /**