diff --git a/src/AutoHideDockContainer.cpp b/src/AutoHideDockContainer.cpp index 1124262..1f0f1aa 100644 --- a/src/AutoHideDockContainer.cpp +++ b/src/AutoHideDockContainer.cpp @@ -265,6 +265,7 @@ void CAutoHideDockContainer::updateSize() //============================================================================ CAutoHideDockContainer::~CAutoHideDockContainer() { + qDebug() << "~CAutoHideDockContainer()" ADS_PRINT("~CAutoHideDockContainer"); // Remove event filter in case there are any queued messages diff --git a/src/AutoHideSideBar.cpp b/src/AutoHideSideBar.cpp index 9fd7709..17d25c8 100644 --- a/src/AutoHideSideBar.cpp +++ b/src/AutoHideSideBar.cpp @@ -143,6 +143,7 @@ CAutoHideDockContainer* CAutoHideSideBar::insertDockWidget(int Index, CDockWidge auto AutoHideContainer = new CAutoHideDockContainer(DockWidget, d->SideTabArea, d->ContainerWidget); DockWidget->dockManager()->dockFocusController()->clearDockWidgetFocus(DockWidget); auto Tab = AutoHideContainer->autoHideTab(); + DockWidget->setSideTabWidget(Tab); insertTab(Index, Tab); return AutoHideContainer; } diff --git a/src/DockAreaTitleBar.cpp b/src/DockAreaTitleBar.cpp index 87d3c51..94781b1 100644 --- a/src/DockAreaTitleBar.cpp +++ b/src/DockAreaTitleBar.cpp @@ -498,13 +498,14 @@ void CDockAreaTitleBar::onAutoHideButtonClicked() } else { + qDebug() << "d->DockArea->currentDockWidget()->toggleAutoHide()"; d->DockArea->currentDockWidget()->toggleAutoHide(); } } //============================================================================ -void CDockAreaTitleBar::onAutoHideDockAreaClicked() +void CDockAreaTitleBar::onAutoHideDockAreaActionClicked() { d->DockArea->toggleAutoHide(); } @@ -675,7 +676,7 @@ void CDockAreaTitleBar::contextMenuEvent(QContextMenuEvent* ev) Action->setEnabled(d->DockArea->features().testFlag(CDockWidget::DockWidgetFloatable)); if (CDockManager::testAutoHideConfigFlag(CDockManager::AutoHideFeatureEnabled)) { - Action = Menu.addAction(IsAutoHide ? tr("Dock") : tr("Auto Hide Group"), this, SLOT(onAutoHideDockAreaClicked())); + Action = Menu.addAction(IsAutoHide ? tr("Dock") : tr("Auto Hide Group"), this, SLOT(onAutoHideDockAreaActionClicked())); Action->setEnabled(d->DockArea->features().testFlag(CDockWidget::DockWidgetPinnable)); } Menu.addSeparator(); diff --git a/src/DockAreaTitleBar.h b/src/DockAreaTitleBar.h index 88e4fdd..b2c81e8 100644 --- a/src/DockAreaTitleBar.h +++ b/src/DockAreaTitleBar.h @@ -62,7 +62,7 @@ private Q_SLOTS: void onTabsMenuActionTriggered(QAction* Action); void onCurrentTabChanged(int Index); void onAutoHideButtonClicked(); - void onAutoHideDockAreaClicked(); + void onAutoHideDockAreaActionClicked(); protected: /** diff --git a/src/DockAreaWidget.cpp b/src/DockAreaWidget.cpp index fc90cc7..06424c2 100644 --- a/src/DockAreaWidget.cpp +++ b/src/DockAreaWidget.cpp @@ -514,6 +514,15 @@ void CDockAreaWidget::insertDockWidget(int index, CDockWidget* DockWidget, void CDockAreaWidget::removeDockWidget(CDockWidget* DockWidget) { ADS_PRINT("CDockAreaWidget::removeDockWidget"); + + // If this dock area is in a auto hide container, then we can delete + // the auto hide container now + if (isAutoHide()) + { + autoHideDockContainer()->cleanupAndDelete(); + return; + } + auto CurrentDockWidget = currentDockWidget(); auto NextOpenDockWidget = (DockWidget == CurrentDockWidget) ? nextOpenDockWidget(DockWidget) : nullptr; @@ -528,7 +537,7 @@ void CDockAreaWidget::removeDockWidget(CDockWidget* DockWidget) { setCurrentDockWidget(NextOpenDockWidget); } - else if (d->ContentsLayout->isEmpty() && DockContainer->dockAreaCount() >= 1 && !isAutoHide()) // Don't remove empty dock areas that are auto hidden, they'll be deleted by the auto hide dock + else if (d->ContentsLayout->isEmpty() && DockContainer->dockAreaCount() >= 1) // Don't remove empty dock areas that are auto hidden, they'll be deleted by the auto hide dock { ADS_PRINT("Dock Area empty"); DockContainer->removeDockArea(this); @@ -868,7 +877,6 @@ void CDockAreaWidget::updateAutoHideButtonCheckState() //============================================================================ void CDockAreaWidget::updateTitleBarButtonVisibility(bool IsTopLevel) const { - qDebug() << "CDockAreaWidget::updateTitleBarButtonVisibility IsTopLevel " << IsTopLevel; d->updateTitleBarButtonVisibility(IsTopLevel); } @@ -970,9 +978,15 @@ bool CDockAreaWidget::restoreState(CDockingStateReader& s, CDockAreaWidget*& Cre } ADS_PRINT("Dock Widget found - parent " << DockWidget->parent()); + if (DockWidget->autoHideDockContainer()) + { + DockWidget->autoHideDockContainer()->cleanupAndDelete(); + } + // We hide the DockArea here to prevent the short display (the flashing) // of the dock areas during application startup DockArea->hide(); + qDebug() << "DockArea->addDockWidget " << DockWidget->windowTitle(); DockArea->addDockWidget(DockWidget); DockWidget->setToggleViewActionChecked(!Closed); DockWidget->setClosedState(Closed); diff --git a/src/DockContainerWidget.cpp b/src/DockContainerWidget.cpp index ee73817..b156c2f 100644 --- a/src/DockContainerWidget.cpp +++ b/src/DockContainerWidget.cpp @@ -1440,6 +1440,7 @@ void CDockContainerWidget::deleteAutoHideWidgets() d->AutoHideWidgets.clear(); } + //============================================================================ QList CDockContainerWidget::autoHideWidgets() const { diff --git a/src/DockManager.cpp b/src/DockManager.cpp index 268dafc..08b7a9c 100644 --- a/src/DockManager.cpp +++ b/src/DockManager.cpp @@ -437,7 +437,6 @@ bool DockManagerPrivate::restoreState(const QByteArray& State, int version) // Hide updates of floating widgets from use hideFloatingWidgets(); markDockWidgetsDirty(); - _this->deleteAutoHideWidgets(); if (!restoreStateFromXml(state, version)) {