From c80174e7e5fc78ebd226255e05fb3da5bddd9839 Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Thu, 27 Oct 2022 15:59:08 +0200 Subject: [PATCH] Removed superfluous code and simplified some things --- src/AutoHideDockContainer.cpp | 4 ++-- src/DockAreaWidget.cpp | 1 + src/DockContainerWidget.cpp | 30 ++++++++++++------------------ 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/src/AutoHideDockContainer.cpp b/src/AutoHideDockContainer.cpp index ed1c5c6..079c3a3 100644 --- a/src/AutoHideDockContainer.cpp +++ b/src/AutoHideDockContainer.cpp @@ -211,7 +211,6 @@ void CAutoHideDockContainer::updateSize() { auto dockContainerParent = parentContainer(); auto rect = dockContainerParent->contentRect(); - qDebug() << "Size " << d->Size; switch (sideTabBarArea()) { @@ -248,6 +247,7 @@ void CAutoHideDockContainer::updateSize() //============================================================================ CAutoHideDockContainer::~CAutoHideDockContainer() { + qDebug() << "~CAutoHideDockContainer()" ADS_PRINT("~CAutoHideDockContainer"); // Remove event filter in case there are any queued messages @@ -323,8 +323,8 @@ void CAutoHideDockContainer::moveContentsToParent() // If we unpin the auto hide tock widget, then we insert it into the same // location like it had as a auto hide widget. This brings the least surprise // to the user and he does not have to search where the widget was inserted. + d->DockWidget->setDockArea(nullptr); parentContainer()->addDockWidget(d->getDockWidgetArea(d->SideTabBarArea), d->DockWidget); - parentContainer()->removeDockArea(d->DockArea); } diff --git a/src/DockAreaWidget.cpp b/src/DockAreaWidget.cpp index c116e3b..fa66f85 100644 --- a/src/DockAreaWidget.cpp +++ b/src/DockAreaWidget.cpp @@ -501,6 +501,7 @@ void CDockAreaWidget::insertDockWidget(int index, CDockWidget* DockWidget, //============================================================================ void CDockAreaWidget::removeDockWidget(CDockWidget* DockWidget) { + qDebug() << "CDockAreaWidget::removeDockWidget"; ADS_PRINT("CDockAreaWidget::removeDockWidget"); auto CurrentDockWidget = currentDockWidget(); auto NextOpenDockWidget = (DockWidget == CurrentDockWidget) ? nextOpenDockWidget(DockWidget) : nullptr; diff --git a/src/DockContainerWidget.cpp b/src/DockContainerWidget.cpp index 35ed4fb..2fe9e05 100644 --- a/src/DockContainerWidget.cpp +++ b/src/DockContainerWidget.cpp @@ -853,6 +853,7 @@ void DockContainerWidgetPrivate::addDockAreasToList(const QList NewDockAreas) { + qDebug() << "DockContainerWidgetPrivate::appendDockAreas"; DockAreas.append(NewDockAreas); for (auto DockArea : NewDockAreas) { @@ -898,6 +899,8 @@ void DockContainerWidgetPrivate::saveChildNodesState(QXmlStreamWriter& s, QWidge } } + +//============================================================================ void DockContainerWidgetPrivate::saveAutoHideWidgetsState(QXmlStreamWriter& s) { for (const auto sideTabBar : SideTabBarWidgets.values()) @@ -1730,7 +1733,15 @@ void CDockContainerWidget::addDockArea(CDockAreaWidget* DockAreaWidget, //============================================================================ void CDockContainerWidget::removeDockArea(CDockAreaWidget* area) { + qDebug() << "CDockContainerWidget::removeDockArea " << d->DockAreas.contains(area); ADS_PRINT("CDockContainerWidget::removeDockArea"); + // If it is an auto hide area, then there is nothing much to do + if (area->isAutoHide()) + { + area->setAutoHideDockContainer(nullptr); + return; + } + area->disconnect(this); d->DockAreas.removeAll(area); CDockSplitter* Splitter = internal::findParent(area); @@ -1746,24 +1757,6 @@ void CDockContainerWidget::removeDockArea(CDockAreaWidget* area) *p = nullptr; } - if (area->isAutoHide()) - { - // Removing an area from an auto hide container widget implies deleting the whole auto hide widget - // So cleanup will be done when the auto hide container widget is deleted - // Note: there is no parent splitter - CDockWidget* TopLevelWidget = topLevelDockWidget(); - - // Updated the title bar visibility of the dock widget if there is only - // one single visible dock widget - CDockWidget::emitTopLevelEventForWidget(TopLevelWidget, true); - dumpLayout(); - d->emitDockAreasRemoved(); - area->setAutoHideDockContainer(nullptr); - area->updateAutoHideButtonCheckState(); - area->updateTitleBarButtonToolTip(); - return; - } - // If splitter has more than 1 widgets, we are finished and can leave if (Splitter->count() > 1) { @@ -1953,6 +1946,7 @@ void CDockContainerWidget::dropFloatingWidget(CFloatingDockContainer* FloatingWi void CDockContainerWidget::dropWidget(QWidget* Widget, DockWidgetArea DropArea, CDockAreaWidget* TargetAreaWidget) { CDockWidget* SingleDockWidget = topLevelDockWidget(); + qDebug() << "CDockContainerWidget::dropWidget"; if (TargetAreaWidget) { d->moveToNewSection(Widget, TargetAreaWidget, DropArea);