diff --git a/examples/autohide/mainwindow.cpp b/examples/autohide/mainwindow.cpp index ff9259a..1e9a448 100644 --- a/examples/autohide/mainwindow.cpp +++ b/examples/autohide/mainwindow.cpp @@ -46,6 +46,7 @@ CMainWindow::CMainWindow(QWidget *parent) TableDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget); TableDockWidget->resize(250, 150); TableDockWidget->setMinimumSize(200,150); + TableDockWidget->setFeature(CDockWidget::DockWidgetDeleteOnClose, true); DockManager->addOverlayDockWidget(CDockWidgetSideTab::SideTabBarArea::Left, TableDockWidget); ui->menuView->addAction(TableDockWidget->toggleViewAction()); diff --git a/src/DockAreaWidget.cpp b/src/DockAreaWidget.cpp index fc47706..e471eb0 100644 --- a/src/DockAreaWidget.cpp +++ b/src/DockAreaWidget.cpp @@ -1049,11 +1049,19 @@ void CDockAreaWidget::closeArea() { for (auto DockWidget : openedDockWidgets()) { - if ((DockWidget->features().testFlag(CDockWidget::DockWidgetDeleteOnClose) && DockWidget->features().testFlag(CDockWidget::DockWidgetForceCloseWithArea)) || - DockWidget->features().testFlag(CDockWidget::CustomCloseHandling) && !isOverlayed()) + if ((DockWidget->features().testFlag(CDockWidget::DockWidgetDeleteOnClose) && DockWidget->features().testFlag(CDockWidget::DockWidgetForceCloseWithArea)) || + DockWidget->features().testFlag(CDockWidget::CustomCloseHandling)) + { + DockWidget->closeDockWidgetInternal(); + } + else if (DockWidget->features().testFlag(CDockWidget::DockWidgetDeleteOnClose) && isOverlayed()) + { DockWidget->closeDockWidgetInternal(); + } else + { DockWidget->toggleView(false); + } } } } diff --git a/src/DockWidget.cpp b/src/DockWidget.cpp index ecc2662..9f7f9bf 100644 --- a/src/DockWidget.cpp +++ b/src/DockWidget.cpp @@ -1015,6 +1015,10 @@ bool CDockWidget::closeDockWidgetInternal(bool ForceClose) FloatingWidget->hide(); } } + if (d->DockArea && d->DockArea->isOverlayed()) + { + d->DockArea->overlayDockContainer()->cleanupAndDelete(); + } deleteDockWidget(); Q_EMIT closed(); }