diff --git a/src/DockAreaWidget.cpp b/src/DockAreaWidget.cpp index 6d3b8c9..fe9385d 100644 --- a/src/DockAreaWidget.cpp +++ b/src/DockAreaWidget.cpp @@ -86,6 +86,18 @@ public: } + /** + * Delete widgets without parents in this layout + */ + ~CDockAreaLayout() + { + for(auto Widget : m_Widgets) + { + if(!Widget->parent()) + delete Widget; + } + } + /** * Returns the number of widgets in this layout */ @@ -467,6 +479,14 @@ void CDockAreaWidget::removeDockWidget(CDockWidget* DockWidget) ADS_PRINT("Dock Area empty"); DockContainer->removeDockArea(this); this->deleteLater(); + if(DockContainer->dockAreaCount() == 0) + { + if(CFloatingDockContainer* FloatingDockContainer = DockContainer->floatingWidget()) + { + FloatingDockContainer->hide(); + FloatingDockContainer->deleteLater(); + } + } } else if (DockWidget == CurrentDockWidget) { diff --git a/src/DockManager.cpp b/src/DockManager.cpp index 717ffde..d04cc50 100644 --- a/src/DockManager.cpp +++ b/src/DockManager.cpp @@ -654,7 +654,14 @@ void CDockManager::showEvent(QShowEvent *event) for (auto FloatingWidget : d->UninitializedFloatingWidgets) { - FloatingWidget->show(); + for(CDockWidget* DockWidget : FloatingWidget->dockWidgets()) + { + if(!DockWidget->isClosed()) + { + FloatingWidget->show(); + break; + } + } } d->UninitializedFloatingWidgets.clear(); }