From 3f256f72499fd1fb82c08a0dc264e69ca5004598 Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Thu, 27 Oct 2022 13:39:00 +0200 Subject: [PATCH 01/22] Some small renamings --- src/AutoHideDockContainer.cpp | 6 ++---- src/DockContainerWidget.cpp | 14 +++++++------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/AutoHideDockContainer.cpp b/src/AutoHideDockContainer.cpp index 7e8bae4..ed1c5c6 100644 --- a/src/AutoHideDockContainer.cpp +++ b/src/AutoHideDockContainer.cpp @@ -103,7 +103,6 @@ struct AutoHideDockContainerPrivate CAutoHideDockContainer* _this; CDockAreaWidget* DockArea{nullptr}; CDockWidget* DockWidget{nullptr}; - QPointer DockManager{nullptr}; SideBarLocation SideTabBarArea; QBoxLayout* Layout; CResizeHandle* ResizeHandle = nullptr; @@ -172,7 +171,6 @@ CAutoHideDockContainer::CAutoHideDockContainer(CDockManager* DockManager, SideBa Super(parent), d(new AutoHideDockContainerPrivate(this)) { - d->DockManager = DockManager; d->SideTabBarArea = area; d->DockArea = new CDockAreaWidget(DockManager, parent); d->DockArea->setObjectName("autoHideDockArea"); @@ -254,7 +252,7 @@ CAutoHideDockContainer::~CAutoHideDockContainer() // Remove event filter in case there are any queued messages qApp->removeEventFilter(this); - if (d->DockManager) + if (parentContainer()) { parentContainer()->removeAutoHideWidget(this); } @@ -424,7 +422,7 @@ void CAutoHideDockContainer::collapseView(bool Enable) d->updateResizeHandleSizeLimitMax(); raise(); show(); - d->DockManager->setDockWidgetFocused(d->DockWidget); + d->DockWidget->dockManager()->setDockWidgetFocused(d->DockWidget); qApp->installEventFilter(this); } diff --git a/src/DockContainerWidget.cpp b/src/DockContainerWidget.cpp index 3fb36e2..35ed4fb 100644 --- a/src/DockContainerWidget.cpp +++ b/src/DockContainerWidget.cpp @@ -1065,17 +1065,17 @@ bool DockContainerWidgetPrivate::restoreAutoHideDockArea(CDockingStateReader& s, } CDockAreaWidget* DockArea = nullptr; - CAutoHideDockContainer* dockContainer = nullptr; + CAutoHideDockContainer* AutoHideContainer = nullptr; if (!Testing) { - dockContainer = new CAutoHideDockContainer(DockManager, area, _this); - if (!dockContainer->restoreState(s, Testing)) + AutoHideContainer = new CAutoHideDockContainer(DockManager, area, _this); + if (!AutoHideContainer->restoreState(s, Testing)) { return false; } - dockContainer->hide(); - DockArea = dockContainer->dockAreaWidget(); + AutoHideContainer->hide(); + DockArea = AutoHideContainer->dockAreaWidget(); DockArea->updateAutoHideButtonCheckState(); DockArea->updateTitleBarButtonToolTip(); } @@ -1120,9 +1120,9 @@ bool DockContainerWidgetPrivate::restoreAutoHideDockArea(CDockingStateReader& s, DockArea->autoHideDockContainer()->toggleView(!Closed); } - if (dockContainer && !dockContainer->dockWidget()) + if (AutoHideContainer && !AutoHideContainer->dockWidget()) { - dockContainer->cleanupAndDelete(); + AutoHideContainer->cleanupAndDelete(); } return true; From c80174e7e5fc78ebd226255e05fb3da5bddd9839 Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Thu, 27 Oct 2022 15:59:08 +0200 Subject: [PATCH 02/22] 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); From f6b77f5c3c813a74ab25e09890e5a1e30beb2b86 Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Fri, 28 Oct 2022 11:11:35 +0200 Subject: [PATCH 03/22] Implemented showing and hiding of side bar when it does not contain any visible tab --- src/AutoHideDockContainer.cpp | 1 + src/AutoHideDockContainer.h | 6 ++-- src/DockWidget.cpp | 4 ++- src/SideTabBar.cpp | 63 +++++++++++++++++++++++++++++++++++ src/SideTabBar.h | 4 ++- 5 files changed, 74 insertions(+), 4 deletions(-) diff --git a/src/AutoHideDockContainer.cpp b/src/AutoHideDockContainer.cpp index 079c3a3..aa183ca 100644 --- a/src/AutoHideDockContainer.cpp +++ b/src/AutoHideDockContainer.cpp @@ -107,6 +107,7 @@ struct AutoHideDockContainerPrivate QBoxLayout* Layout; CResizeHandle* ResizeHandle = nullptr; QSize Size; // creates invalid size + CDockWidgetSideTab* SideTab = nullptr; /** * Private data constructor diff --git a/src/AutoHideDockContainer.h b/src/AutoHideDockContainer.h index 047290f..b684bb4 100644 --- a/src/AutoHideDockContainer.h +++ b/src/AutoHideDockContainer.h @@ -70,12 +70,14 @@ public: /** * Create Auto Hide widget with a dock manager */ - CAutoHideDockContainer(CDockManager* DockManager, SideBarLocation area, CDockContainerWidget* parent); + CAutoHideDockContainer(CDockManager* DockManager, SideBarLocation area, + CDockContainerWidget* parent); /** * Create Auto Hide widget with the given dock widget */ - CAutoHideDockContainer(CDockWidget* DockWidget, SideBarLocation area, CDockContainerWidget* parent); + CAutoHideDockContainer(CDockWidget* DockWidget, SideBarLocation area, + CDockContainerWidget* parent); /** * Virtual Destructor diff --git a/src/DockWidget.cpp b/src/DockWidget.cpp index 745a6fe..9611f7c 100644 --- a/src/DockWidget.cpp +++ b/src/DockWidget.cpp @@ -79,7 +79,6 @@ struct DockWidgetPrivate QBoxLayout* Layout = nullptr; QWidget* Widget = nullptr; CDockWidgetTab* TabWidget = nullptr; - CDockWidgetSideTab* SideTabWidget = nullptr; CDockWidget::DockWidgetFeatures Features = CDockWidget::DefaultDockWidgetFeatures; CDockManager* DockManager = nullptr; CDockAreaWidget* DockArea = nullptr; @@ -97,6 +96,7 @@ struct DockWidgetPrivate WidgetFactory* Factory = nullptr; double DefaultAutoHideDockProportion = 0.25; CDockWidget::eAutoHideInsertOrder AutoHideInsertOrder = CDockWidget::Last; + QPointer SideTabWidget; /** * Private data constructor @@ -246,6 +246,8 @@ void DockWidgetPrivate::updateParentDockArea() } } + +//============================================================================ void DockWidgetPrivate::closeAutoHideDockWidgetsIfNeeded() { if (_this->dockContainer() && _this->dockContainer()->openedDockWidgets().isEmpty() && !_this->dockManager()->isRestoringState()) diff --git a/src/SideTabBar.cpp b/src/SideTabBar.cpp index 8f81a87..85718ca 100644 --- a/src/SideTabBar.cpp +++ b/src/SideTabBar.cpp @@ -113,6 +113,7 @@ CSideTabBar::CSideTabBar(CDockContainerWidget* parent, SideBarLocation area) : //============================================================================ CSideTabBar::~CSideTabBar() { + qDebug() << "~CSideTabBar() "; // The SideTabeBar is not the owner of the tabs and to prevent deletion // we set the parent here to nullptr to remove it from the children auto Tabs = findChildren(QString(), Qt::FindDirectChildrenOnly); @@ -127,6 +128,7 @@ CSideTabBar::~CSideTabBar() //============================================================================ void CSideTabBar::insertSideTab(int Index, CDockWidgetSideTab* SideTab) { + SideTab->installEventFilter(this); d->TabsLayout->insertWidget(Index, SideTab); SideTab->setSideTabBar(this); show(); @@ -166,6 +168,7 @@ void CSideTabBar::removeDockWidget(CDockWidget* DockWidget) void CSideTabBar::removeSideTab(CDockWidgetSideTab* SideTab) { qDebug() << "CSideTabBar::removeSideTab " << SideTab->text(); + SideTab->removeEventFilter(this); d->TabsLayout->removeWidget(SideTab); if (d->TabsLayout->isEmpty()) { @@ -174,6 +177,65 @@ void CSideTabBar::removeSideTab(CDockWidgetSideTab* SideTab) } +//============================================================================ +bool CSideTabBar::event(QEvent* e) +{ + qDebug() << e; + switch (e->type()) + { + case QEvent::ChildRemoved: + if (d->TabsLayout->isEmpty()) + { + hide(); + } + break; + + case QEvent::Resize: + if (d->TabsLayout->count()) + { + auto ev = static_cast(e); + auto Tab = tabAt(0); + int Size = d->isHorizontal() ? ev->size().height() : ev->size().width(); + int TabSize = d->isHorizontal() ? Tab->size().height() : Tab->size().width(); + // If the size of the side bar is less than the size of the first tab + // then there are no visible tabs in this side bar. This check will + // fail if someone will force a very big border via CSS!! + if (Size < TabSize) + { + hide(); + } + } + else + { + hide(); + } + break; + + default: + break; + } + return Super::event(e); +} + + +//============================================================================ +bool CSideTabBar::eventFilter(QObject *watched, QEvent *event) +{ + if (event->type() != QEvent::ShowToParent) + { + return false; + } + + // As soon as on tab is shhown, we need to show the side tab bar + auto Tab = qobject_cast(watched); + if (Tab) + { + show(); + } + return false; +} + + //============================================================================ void CSideTabBar::paintEvent(QPaintEvent* event) { @@ -212,4 +274,5 @@ SideBarLocation CSideTabBar::sideTabBarArea() const { return d->SideTabArea; } + } diff --git a/src/SideTabBar.h b/src/SideTabBar.h index ecafb6e..890a10d 100644 --- a/src/SideTabBar.h +++ b/src/SideTabBar.h @@ -55,7 +55,9 @@ private: friend class DockWidgetSideTab; protected: - void paintEvent(QPaintEvent* event) override; + virtual void paintEvent(QPaintEvent* event) override; + virtual bool event(QEvent* e) override; + virtual bool eventFilter(QObject *watched, QEvent *event) override; public: using Super = QFrame; From 6cf05c3438edf057dd78dcd06b13330a6befc05a Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Fri, 28 Oct 2022 11:13:18 +0200 Subject: [PATCH 04/22] Removed debug output --- src/SideTabBar.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/SideTabBar.cpp b/src/SideTabBar.cpp index 85718ca..f373fbf 100644 --- a/src/SideTabBar.cpp +++ b/src/SideTabBar.cpp @@ -180,7 +180,6 @@ void CSideTabBar::removeSideTab(CDockWidgetSideTab* SideTab) //============================================================================ bool CSideTabBar::event(QEvent* e) { - qDebug() << e; switch (e->type()) { case QEvent::ChildRemoved: From b85a6b55d9321d8773e0daf926a95ea0d8d4a941 Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Fri, 28 Oct 2022 11:14:04 +0200 Subject: [PATCH 05/22] Removed debug output --- src/SideTabBar.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SideTabBar.cpp b/src/SideTabBar.cpp index f373fbf..5cd1d4e 100644 --- a/src/SideTabBar.cpp +++ b/src/SideTabBar.cpp @@ -160,7 +160,8 @@ CAutoHideDockContainer* CSideTabBar::insertDockWidget(int Index, CDockWidget* Do //============================================================================ void CSideTabBar::removeDockWidget(CDockWidget* DockWidget) { - + Q_UNUSED(DockWidget); + // TODO implement } From b70fc7b3e837a6724add021ed5b1c5c8c6b880b5 Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Fri, 28 Oct 2022 11:22:42 +0200 Subject: [PATCH 06/22] Added some SideBar documentation --- src/SideTabBar.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/SideTabBar.h b/src/SideTabBar.h index 890a10d..eb08973 100644 --- a/src/SideTabBar.h +++ b/src/SideTabBar.h @@ -41,7 +41,11 @@ class CDockWidgetSideTab; class CAutoHideDockContainer; /** - * Side tab widget that is shown at the edges of a dock container. + * Side tab bar widget that is shown at the edges of a dock container. + * The tab bar is only visible, if it contains visible content, that means if + * it contains visible tabs. If it is empty or all tabs are hidden, then the + * side bar is also hidden. As soon as one single tab becomes visible, this + * tab bar will be shown. */ class ADS_EXPORT CSideTabBar : public QFrame { From ae5a75bc3f9ab77a559e037dd75d366b1bbaebb8 Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Fri, 28 Oct 2022 13:19:38 +0200 Subject: [PATCH 07/22] Removed DockWidget->sideTabWidget()->setProperty("focused", Focused), DockWidget->sideTabWidget()->updateStyle() because it is not required --- src/AutoHideDockContainer.cpp | 31 +++++++++++++++++++------------ src/AutoHideDockContainer.h | 5 +++++ src/DockContainerWidget.cpp | 1 - src/DockFocusController.cpp | 2 -- src/DockWidget.h | 4 +++- src/DockWidgetSideTab.cpp | 2 +- src/DockWidgetSideTab.h | 2 +- src/SideTabBar.cpp | 3 ++- 8 files changed, 31 insertions(+), 19 deletions(-) diff --git a/src/AutoHideDockContainer.cpp b/src/AutoHideDockContainer.cpp index 954f2a5..d3ba068 100644 --- a/src/AutoHideDockContainer.cpp +++ b/src/AutoHideDockContainer.cpp @@ -268,6 +268,14 @@ CSideTabBar* CAutoHideDockContainer::sideTabBar() const return parentContainer()->sideTabBar(d->SideTabBarArea); } + +//============================================================================ +CDockWidgetSideTab* CAutoHideDockContainer::sideTab() const +{ + return d->SideTab; +} + + //============================================================================ CDockWidget* CAutoHideDockContainer::dockWidget() const { @@ -284,13 +292,13 @@ void CAutoHideDockContainer::addDockWidget(CDockWidget* DockWidget) } d->DockWidget = DockWidget; + d->SideTab = DockWidget->sideTabWidget(); CDockAreaWidget* OldDockArea = DockWidget->dockAreaWidget(); if (OldDockArea) { OldDockArea->removeDockWidget(DockWidget); } d->DockArea->addDockWidget(DockWidget); - d->DockWidget->sideTabWidget()->updateOrientationAndSpacing(d->SideTabBarArea); // Prevent overriding of d->Size parameter when this function is called during // state restoring @@ -336,9 +344,10 @@ void CAutoHideDockContainer::cleanupAndDelete() const auto dockWidget = d->DockWidget; if (dockWidget) { - dockWidget->sideTabWidget()->removeFromSideTabBar(); - dockWidget->sideTabWidget()->setParent(dockWidget); - dockWidget->sideTabWidget()->hide(); + auto SideTab = d->SideTab; + SideTab->removeFromSideTabBar(); + SideTab->setParent(dockWidget); + SideTab->hide(); } hide(); @@ -391,18 +400,16 @@ void CAutoHideDockContainer::toggleView(bool Enable) { if (Enable) { - const auto dockWidget = d->DockWidget; - if (dockWidget) + if (d->SideTab) { - dockWidget->sideTabWidget()->show(); + d->SideTab->show(); } } else { - const auto dockWidget = d->DockWidget; - if (dockWidget) + if (d->SideTab) { - dockWidget->sideTabWidget()->hide(); + d->SideTab->hide(); } hide(); qApp->removeEventFilter(this); @@ -429,7 +436,7 @@ void CAutoHideDockContainer::collapseView(bool Enable) } ADS_PRINT("CAutoHideDockContainer::collapseView " << Enable); - d->DockWidget->sideTabWidget()->updateStyle(); + d->SideTab->updateStyle(); } @@ -494,7 +501,7 @@ bool CAutoHideDockContainer::eventFilter(QObject* watched, QEvent* event) // because the side tab click handler will call collapseView(). If we // do not ignore this here, then we will collapse the container and the side tab // click handler will uncollapse it - auto SideTab = d->DockWidget->sideTabWidget(); + auto SideTab = d->SideTab; pos = SideTab->mapFromGlobal(me->globalPos()); if (SideTab->rect().contains(pos)) { diff --git a/src/AutoHideDockContainer.h b/src/AutoHideDockContainer.h index c55f9cc..2c0538e 100644 --- a/src/AutoHideDockContainer.h +++ b/src/AutoHideDockContainer.h @@ -89,6 +89,11 @@ public: */ CSideTabBar* sideTabBar() const; + /** + * Returns the side tab + */ + CDockWidgetSideTab* sideTab() const; + /** * Get's the dock widget in this dock container */ diff --git a/src/DockContainerWidget.cpp b/src/DockContainerWidget.cpp index f6b15ed..d628ab3 100644 --- a/src/DockContainerWidget.cpp +++ b/src/DockContainerWidget.cpp @@ -1546,7 +1546,6 @@ CAutoHideDockContainer* CDockContainerWidget::createAndSetupAutoHideContainer( return nullptr; } - DockWidget->sideTabWidget()->updateOrientationAndSpacing(area); sideTabBar(area)->insertSideTab(insertOrder == CDockWidget::First ? 0 : -1, DockWidget->sideTabWidget()); DockWidget->sideTabWidget()->show(); diff --git a/src/DockFocusController.cpp b/src/DockFocusController.cpp index f1d3435..3056c07 100644 --- a/src/DockFocusController.cpp +++ b/src/DockFocusController.cpp @@ -70,8 +70,6 @@ static void updateDockWidgetFocusStyle(CDockWidget* DockWidget, bool Focused) DockWidget->setProperty("focused", Focused); DockWidget->tabWidget()->setProperty("focused", Focused); DockWidget->tabWidget()->updateStyle(); - DockWidget->sideTabWidget()->setProperty("focused", Focused); - DockWidget->sideTabWidget()->updateStyle(); internal::repolishStyle(DockWidget); } diff --git a/src/DockWidget.h b/src/DockWidget.h index 60df0e3..52d87b2 100644 --- a/src/DockWidget.h +++ b/src/DockWidget.h @@ -365,7 +365,9 @@ public: CDockAreaWidget* dockAreaWidget() const; /** - * Returns the side tab widget for this dock + * Returns the side tab widget for this dock, if this dock widget is in + * a auto hide container. If it is not in a auto hide container, then this + * function returns a nullptr, */ CDockWidgetSideTab* sideTabWidget() const; diff --git a/src/DockWidgetSideTab.cpp b/src/DockWidgetSideTab.cpp index e4e6423..3eb2845 100644 --- a/src/DockWidgetSideTab.cpp +++ b/src/DockWidgetSideTab.cpp @@ -142,7 +142,7 @@ Qt::Orientation CDockWidgetSideTab::orientation() const //============================================================================ -void CDockWidgetSideTab::updateOrientationAndSpacing(SideBarLocation area) +void CDockWidgetSideTab::updateOrientationForArea(SideBarLocation area) { setOrientation((area == Bottom || area == Top) ? Qt::Horizontal : Qt::Vertical); diff --git a/src/DockWidgetSideTab.h b/src/DockWidgetSideTab.h index f9c2bc6..f01e8b8 100644 --- a/src/DockWidgetSideTab.h +++ b/src/DockWidgetSideTab.h @@ -106,7 +106,7 @@ public: /** * Update the orientation, visibility and spacing based on the area and the config */ - void updateOrientationAndSpacing(SideBarLocation area); + void updateOrientationForArea(SideBarLocation area); /** * Returns true, if this is the active tab. The tab is active if the auto hide widget is visible diff --git a/src/SideTabBar.cpp b/src/SideTabBar.cpp index 5cd1d4e..cf380e4 100644 --- a/src/SideTabBar.cpp +++ b/src/SideTabBar.cpp @@ -128,6 +128,7 @@ CSideTabBar::~CSideTabBar() //============================================================================ void CSideTabBar::insertSideTab(int Index, CDockWidgetSideTab* SideTab) { + SideTab->updateOrientationForArea(d->SideTabArea); SideTab->installEventFilter(this); d->TabsLayout->insertWidget(Index, SideTab); SideTab->setSideTabBar(this); @@ -142,7 +143,7 @@ CAutoHideDockContainer* CSideTabBar::insertDockWidget(int Index, CDockWidget* Do auto area = sideTabBarArea(); qDebug() << "area " << area; Tab->setSideTabBar(this); - Tab->updateOrientationAndSpacing(area); + Tab->updateOrientationForArea(area); d->TabsLayout->insertWidget(Index, Tab); Tab->show(); From 1eaeed6c566e7666b7c0eb9e7ade7c030ec5de7b Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Fri, 28 Oct 2022 13:20:27 +0200 Subject: [PATCH 08/22] Changed root index of file system model to prevent lagging UI if network folders are missing --- demo/MainWindow.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/demo/MainWindow.cpp b/demo/MainWindow.cpp index a474510..57d5286 100644 --- a/demo/MainWindow.cpp +++ b/demo/MainWindow.cpp @@ -216,6 +216,7 @@ struct MainWindowPrivate QFileSystemModel* m = new QFileSystemModel(w); m->setRootPath(QDir::currentPath()); w->setModel(m); + w->setRootIndex(m->index(QDir::currentPath())); ads::CDockWidget* DockWidget = new ads::CDockWidget(QString("Filesystem %1") .arg(FileSystemCount++)); DockWidget->setWidget(w); From 6adce7337b6cc067755a0000e2faeb7ff578754c Mon Sep 17 00:00:00 2001 From: Uwe Date: Fri, 28 Oct 2022 13:35:52 +0200 Subject: [PATCH 09/22] Some restructuring in default.css and default_linux.css to improve readibility --- src/stylesheets/default.css | 46 ++++++++++---------- src/stylesheets/default_linux.css | 70 ++++++++++++++++++++++--------- 2 files changed, 72 insertions(+), 44 deletions(-) diff --git a/src/stylesheets/default.css b/src/stylesheets/default.css index fd431b1..3a9fddb 100644 --- a/src/stylesheets/default.css +++ b/src/stylesheets/default.css @@ -32,7 +32,7 @@ ads--CDockAreaWidget { /***************************************************************************** - * CDockWidgetTab + * CDockWidgetTab and close button styling *****************************************************************************/ ads--CDockWidgetTab { background: palette(window); @@ -57,6 +57,26 @@ ads--CDockWidgetTab[activeTab="true"] QLabel { } +#tabCloseButton { + margin-top: 2px; + background: none; + border: none; + padding: 0px -2px; + qproperty-icon: url(:/ads/images/close-button.svg), + url(:/ads/images/close-button-disabled.svg) disabled; + qproperty-iconSize: 16px; +} + +#tabCloseButton:hover { + border: 1px solid rgba(0, 0, 0, 32); + background: rgba(0, 0, 0, 16); +} + +#tabCloseButton:pressed { + background: rgba(0, 0, 0, 32); +} + + /***************************************************************************** * CDockWidget *****************************************************************************/ @@ -74,30 +94,6 @@ QScrollArea#dockWidgetScrollArea { } -/***************************************************************************** - * Dock widget tab styling - *****************************************************************************/ -#tabCloseButton { - margin-top: 2px; - background: none; - border: none; - padding: 0px -2px; - qproperty-icon: url(:/ads/images/close-button.svg), - url(:/ads/images/close-button-disabled.svg) disabled; - qproperty-iconSize: 16px; -} - -#tabCloseButton:hover { - border: 1px solid rgba(0, 0, 0, 32); - background: rgba(0, 0, 0, 16); -} - -#tabCloseButton:pressed { - background: rgba(0, 0, 0, 32); -} - - - /***************************************************************************** * Dock area title bar and buttons styling *****************************************************************************/ diff --git a/src/stylesheets/default_linux.css b/src/stylesheets/default_linux.css index ac41491..43f6e17 100644 --- a/src/stylesheets/default_linux.css +++ b/src/stylesheets/default_linux.css @@ -1,9 +1,18 @@ /* * Default style sheet on Linux Platforms */ + +/***************************************************************************** + * CDockContainerWidget + *****************************************************************************/ ads--CDockContainerWidget { background: palette(dark); } + + +/***************************************************************************** + * CDockSplitter + *****************************************************************************/ ads--CDockContainerWidget > QSplitter{ padding: 1 0 1 0; } @@ -12,6 +21,10 @@ ads--CDockContainerWidget ads--CDockSplitter::handle { background: palette(dark); } + +/***************************************************************************** + * CDockAreaWidget + *****************************************************************************/ ads--CDockAreaWidget { background: palette(window); border: 1px solid white; @@ -21,6 +34,11 @@ ads--CDockAreaWidget #tabsMenuButton::menu-indicator { image: none; } + + +/***************************************************************************** + * CDockWidgetTab and close button styling + *****************************************************************************/ ads--CDockWidgetTab { background: palette(window); border-color: palette(light); @@ -43,6 +61,30 @@ ads--CDockWidgetTab[activeTab="true"] QLabel { color: palette(foreground); } + +#tabCloseButton { + margin-top: 2px; + background: none; + border: none; + padding: 0px -2px; + qproperty-icon: url(:/ads/images/close-button.svg), + url(:/ads/images/close-button-disabled.svg) disabled; + qproperty-iconSize: 16px; +} + +#tabCloseButton:hover { + border: 1px solid rgba(0, 0, 0, 32); + background: rgba(0, 0, 0, 16); +} + +#tabCloseButton:pressed { + background: rgba(0, 0, 0, 32); +} + + +/***************************************************************************** + * CDockWidget + *****************************************************************************/ ads--CDockWidget { background: palette(light); border-color: palette(light); @@ -50,33 +92,20 @@ ads--CDockWidget { border-width: 1px 0 0 0; } -ads--CTitleBarButton { - padding: 0px 0px; -} QScrollArea#dockWidgetScrollArea { padding: 0px; border: none; } -#tabCloseButton { - margin-top: 2px; - background: none; - border: none; - padding: 0px -2px; - qproperty-icon: url(:/ads/images/close-button.svg), - url(:/ads/images/close-button-disabled.svg) disabled; - qproperty-iconSize: 16px; + +/***************************************************************************** + * Dock area title bar and buttons styling + *****************************************************************************/ +ads--CTitleBarButton { + padding: 0px 0px; } -#tabCloseButton:hover { - border: 1px solid rgba(0, 0, 0, 32); - background: rgba(0, 0, 0, 16); -} - -#tabCloseButton:pressed { - background: rgba(0, 0, 0, 32); -} #tabsMenuButton { qproperty-icon: url(:/ads/images/tabs-menu-button.svg); @@ -96,6 +125,9 @@ QScrollArea#dockWidgetScrollArea { } +/***************************************************************************** + * Floating widget styling + *****************************************************************************/ ads--CFloatingWidgetTitleBar { background: palette(midlight); qproperty-maximizeIcon: url(:/ads/images/maximize-button.svg); From f4bfa0f3c5ec4bf61f911da925e9ccd1365780d0 Mon Sep 17 00:00:00 2001 From: Uwe Date: Fri, 28 Oct 2022 15:20:56 +0200 Subject: [PATCH 10/22] Changed type of sideTabBarArea properties to int to fix non working Linux stylesheet selectors --- src/AutoHideDockContainer.h | 2 +- src/DockWidgetSideTab.cpp | 10 +++++----- src/DockWidgetSideTab.h | 2 +- src/ResizeHandle.h | 2 +- src/SideTabBar.cpp | 4 ++-- src/SideTabBar.h | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/AutoHideDockContainer.h b/src/AutoHideDockContainer.h index 2c0538e..3a6b8c7 100644 --- a/src/AutoHideDockContainer.h +++ b/src/AutoHideDockContainer.h @@ -53,7 +53,7 @@ class CDockingStateReader; class ADS_EXPORT CAutoHideDockContainer : public QFrame { Q_OBJECT - Q_PROPERTY(ads::SideBarLocation sideTabBarArea READ sideTabBarArea) + Q_PROPERTY(int sideTabBarArea READ sideTabBarArea) private: AutoHideDockContainerPrivate* d; ///< private data (pimpl) friend struct AutoHideDockContainerPrivate; diff --git a/src/DockWidgetSideTab.cpp b/src/DockWidgetSideTab.cpp index 3eb2845..19cae32 100644 --- a/src/DockWidgetSideTab.cpp +++ b/src/DockWidgetSideTab.cpp @@ -47,7 +47,7 @@ struct DockWidgetSideTabPrivate { CDockWidgetSideTab* _this; CDockWidget* DockWidget; - CSideTabBar* SideTabBar; + CSideTabBar* SideTabBar = nullptr; Qt::Orientation Orientation{Qt::Vertical}; /** @@ -106,7 +106,7 @@ CDockWidgetSideTab::~CDockWidgetSideTab() //============================================================================ void CDockWidgetSideTab::updateStyle() { - internal::repolishStyle(this, internal::RepolishDirectChildren); + internal::repolishStyle(this, internal::RepolishDirectChildren); update(); } @@ -114,10 +114,10 @@ void CDockWidgetSideTab::updateStyle() //============================================================================ SideBarLocation CDockWidgetSideTab::sideTabBarArea() const { - auto dockAreaWidget = d->DockWidget->dockAreaWidget(); - if (dockAreaWidget && dockAreaWidget->isAutoHide()) + if (d->SideTabBar) { - return dockAreaWidget->autoHideDockContainer()->sideTabBarArea(); + qDebug() << "CDockWidgetSideTab::sideTabBarArea() " << d->SideTabBar->sideTabBarArea(); + return d->SideTabBar->sideTabBarArea(); } return Left; diff --git a/src/DockWidgetSideTab.h b/src/DockWidgetSideTab.h index f01e8b8..4da3c75 100644 --- a/src/DockWidgetSideTab.h +++ b/src/DockWidgetSideTab.h @@ -50,7 +50,7 @@ class ADS_EXPORT CDockWidgetSideTab : public CPushButton { Q_OBJECT - Q_PROPERTY(ads::SideBarLocation sideTabBarArea READ sideTabBarArea) + Q_PROPERTY(int sideTabBarArea READ sideTabBarArea) Q_PROPERTY(Qt::Orientation orientation READ orientation) Q_PROPERTY(bool activeTab READ isActiveTab) diff --git a/src/ResizeHandle.h b/src/ResizeHandle.h index 81264b1..1b5af32 100644 --- a/src/ResizeHandle.h +++ b/src/ResizeHandle.h @@ -24,7 +24,7 @@ class ADS_EXPORT CResizeHandle : public QFrame { Q_OBJECT Q_DISABLE_COPY(CResizeHandle) - Q_PROPERTY(bool opaqueResize READ opaqueResize WRITE setOpaqueResize) + Q_PROPERTY(bool opaqueResize READ opaqueResize WRITE setOpaqueResize) private: ResizeHandlePrivate* d; ///< private data (pimpl) friend struct ResizeHandlePrivate; diff --git a/src/SideTabBar.cpp b/src/SideTabBar.cpp index cf380e4..d996ede 100644 --- a/src/SideTabBar.cpp +++ b/src/SideTabBar.cpp @@ -128,10 +128,10 @@ CSideTabBar::~CSideTabBar() //============================================================================ void CSideTabBar::insertSideTab(int Index, CDockWidgetSideTab* SideTab) { - SideTab->updateOrientationForArea(d->SideTabArea); SideTab->installEventFilter(this); - d->TabsLayout->insertWidget(Index, SideTab); SideTab->setSideTabBar(this); + SideTab->updateOrientationForArea(d->SideTabArea); + d->TabsLayout->insertWidget(Index, SideTab); show(); } diff --git a/src/SideTabBar.h b/src/SideTabBar.h index eb08973..4ba757a 100644 --- a/src/SideTabBar.h +++ b/src/SideTabBar.h @@ -50,7 +50,7 @@ class CAutoHideDockContainer; class ADS_EXPORT CSideTabBar : public QFrame { Q_OBJECT - Q_PROPERTY(ads::SideBarLocation sideTabBarArea READ sideTabBarArea) + Q_PROPERTY(int sideTabBarArea READ sideTabBarArea) Q_PROPERTY(Qt::Orientation orientation READ orientation) private: From 1189945ef13e9f0bdacd20f2e8dc2797a5e199bc Mon Sep 17 00:00:00 2001 From: Uwe Date: Fri, 28 Oct 2022 15:21:21 +0200 Subject: [PATCH 11/22] Updated Linux css files to properly support new auto hide feature --- demo/MainWindow.cpp | 2 +- src/stylesheets/default.css | 74 ++--- src/stylesheets/default_linux.css | 238 +++++++++++++-- src/stylesheets/focus_highlighting_linux.css | 299 ++++++++++++++++--- 4 files changed, 491 insertions(+), 122 deletions(-) diff --git a/demo/MainWindow.cpp b/demo/MainWindow.cpp index 57d5286..733a9e8 100644 --- a/demo/MainWindow.cpp +++ b/demo/MainWindow.cpp @@ -651,7 +651,7 @@ CMainWindow::CMainWindow(QWidget *parent) : // uncomment the following line to enable focus highlighting of the dock // widget that has the focus - //CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true); + CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true); // uncomment if you would like to enable dock widget auto hiding CDockManager::setConfigFlag(CDockManager::DefaultAutoHideConfig, true); diff --git a/src/stylesheets/default.css b/src/stylesheets/default.css index 3a9fddb..b72c50b 100644 --- a/src/stylesheets/default.css +++ b/src/stylesheets/default.css @@ -18,7 +18,7 @@ ads--CDockContainerWidget > QSplitter { } ads--CDockContainerWidget ads--CDockSplitter::handle { - background: palette(dark); + background: palette(dark); } @@ -26,7 +26,33 @@ ads--CDockContainerWidget ads--CDockSplitter::handle { * CDockAreaWidget *****************************************************************************/ ads--CDockAreaWidget { - background: palette(window); + background: palette(window); +} + +ads--CTitleBarButton { + padding: 0px 0px; +} + + +#tabsMenuButton::menu-indicator { + image: none; +} + +#tabsMenuButton { + qproperty-icon: url(:/ads/images/tabs-menu-button.svg); + qproperty-iconSize: 16px; +} + +#dockAreaCloseButton { + qproperty-icon: url(:/ads/images/close-button.svg), + url(:/ads/images/close-button-disabled.svg) disabled; + qproperty-iconSize: 16px; +} + +#detachGroupButton { + qproperty-icon: url(:/ads/images/detach-button.svg), + url(:/ads/images/detach-button-disabled.svg) disabled; + qproperty-iconSize: 16px; } @@ -94,36 +120,6 @@ QScrollArea#dockWidgetScrollArea { } -/***************************************************************************** - * Dock area title bar and buttons styling - *****************************************************************************/ - ads--CTitleBarButton { - padding: 0px 0px; -} - - -#tabsMenuButton::menu-indicator { - image: none; -} - -#tabsMenuButton { - qproperty-icon: url(:/ads/images/tabs-menu-button.svg); - qproperty-iconSize: 16px; -} - -#dockAreaCloseButton { - qproperty-icon: url(:/ads/images/close-button.svg), - url(:/ads/images/close-button-disabled.svg) disabled; - qproperty-iconSize: 16px; -} - -#detachGroupButton { - qproperty-icon: url(:/ads/images/detach-button.svg), - url(:/ads/images/detach-button-disabled.svg) disabled; - qproperty-iconSize: 16px; -} - - /***************************************************************************** * * Styling of auto hide functionality @@ -135,33 +131,27 @@ QScrollArea#dockWidgetScrollArea { * CDockWidgetSideTab *****************************************************************************/ ads--CDockWidgetSideTab { - /*background: palette(window);*/ - qproperty-iconSize: 16px 16px;/* this is optional in case you would like to change icon size*/ -} - - -ads--CDockWidgetSideTab { + qproperty-iconSize: 16px 16px;/* this is optional in case you would like to change icon size*/ background: none; border: none; padding-left: 2px; padding-right: 0px; text-align: center; + margin-right: 6px; + min-height: 20; } ads--CDockWidgetSideTab[sideTabBarArea="0"], ads--CDockWidgetSideTab[sideTabBarArea="2"] { border-top: 5px solid rgba(0, 0, 0, 48); - margin-right: 6px; - min-height: 20; + } ads--CDockWidgetSideTab[sideTabBarArea="1"], ads--CDockWidgetSideTab[sideTabBarArea="3"] { border-bottom: 5px solid rgba(0, 0, 0, 48); - margin-right: 6px; - min-height: 20; } diff --git a/src/stylesheets/default_linux.css b/src/stylesheets/default_linux.css index 43f6e17..f8dedfe 100644 --- a/src/stylesheets/default_linux.css +++ b/src/stylesheets/default_linux.css @@ -6,7 +6,7 @@ * CDockContainerWidget *****************************************************************************/ ads--CDockContainerWidget { - background: palette(dark); + background: palette(window); } @@ -14,11 +14,11 @@ ads--CDockContainerWidget { * CDockSplitter *****************************************************************************/ ads--CDockContainerWidget > QSplitter{ - padding: 1 0 1 0; + padding: 1 0 1 0; } ads--CDockContainerWidget ads--CDockSplitter::handle { - background: palette(dark); + background: palette(dark); } @@ -26,15 +26,38 @@ ads--CDockContainerWidget ads--CDockSplitter::handle { * CDockAreaWidget *****************************************************************************/ ads--CDockAreaWidget { - background: palette(window); - border: 1px solid white; + background: palette(window); } ads--CDockAreaWidget #tabsMenuButton::menu-indicator { - image: none; + image: none; } +ads--CTitleBarButton { + padding: 0px 0px; +} + + +#tabsMenuButton { + qproperty-icon: url(:/ads/images/tabs-menu-button.svg); + qproperty-iconSize: 16px; +} + + +#dockAreaCloseButton { + qproperty-icon: url(:/ads/images/close-button.svg), + url(:/ads/images/close-button-disabled.svg) disabled; + qproperty-iconSize: 16px; +} + + +#detachGroupButton { + qproperty-icon: url(:/ads/images/detach-button.svg), + url(:/ads/images/detach-button-disabled.svg) disabled; + qproperty-iconSize: 16px; +} + /***************************************************************************** * CDockWidgetTab and close button styling @@ -47,16 +70,19 @@ ads--CDockWidgetTab { padding: 0 0px; } + ads--CDockWidgetTab[activeTab="true"] { background: qlineargradient(spread : pad, x1 : 0, y1 : 0, x2 : 0, y2 : 0.5, stop : 0 palette(window), stop:1 palette(light)); /*background: palette(highlight);*/ } + ads--CDockWidgetTab QLabel { color: palette(dark); } + ads--CDockWidgetTab[activeTab="true"] QLabel { color: palette(foreground); } @@ -99,32 +125,6 @@ QScrollArea#dockWidgetScrollArea { } -/***************************************************************************** - * Dock area title bar and buttons styling - *****************************************************************************/ -ads--CTitleBarButton { - padding: 0px 0px; -} - - -#tabsMenuButton { - qproperty-icon: url(:/ads/images/tabs-menu-button.svg); - qproperty-iconSize: 16px; -} - -#dockAreaCloseButton { - qproperty-icon: url(:/ads/images/close-button.svg), - url(:/ads/images/close-button-disabled.svg) disabled; - qproperty-iconSize: 16px; -} - -#detachGroupButton { - qproperty-icon: url(:/ads/images/detach-button.svg), - url(:/ads/images/detach-button-disabled.svg) disabled; - qproperty-iconSize: 16px; -} - - /***************************************************************************** * Floating widget styling *****************************************************************************/ @@ -154,3 +154,177 @@ ads--CFloatingWidgetTitleBar { #floatingTitleCloseButton:pressed { background: rgba(0, 0, 0, 48); } + + +/***************************************************************************** + * + * Styling of auto hide functionality + * + *****************************************************************************/ + + +/***************************************************************************** + * CDockWidgetSideTab + *****************************************************************************/ +ads--CDockWidgetSideTab { + qproperty-iconSize: 16px 16px;/* this is optional in case you would like to change icon size*/ + padding-left: 2px; + padding-right: 0px; + text-align: center; + margin-right: 6px; + min-height: 20; + border: none; +} + +ads--CDockWidgetSideTab[sideTabBarArea="1"], +ads--CDockWidgetSideTab[sideTabBarArea="3"] { + border-bottom: 5px solid rgba(0, 0, 0, 48); +} + + +ads--CDockWidgetSideTab[sideTabBarArea="0"], +ads--CDockWidgetSideTab[sideTabBarArea="2"] { + border-top: 5px solid rgba(0, 0, 0, 48); +} + + +ads--CDockWidgetSideTab:hover[sideTabBarArea="0"], +ads--CDockWidgetSideTab:hover[sideTabBarArea="2"] { + border-top: 5px solid palette(highlight); + color: palette(highlight); +} + + +ads--CDockWidgetSideTab:hover[sideTabBarArea="1"], +ads--CDockWidgetSideTab:hover[sideTabBarArea="3"] { + border-bottom: 5px solid palette(highlight); + color: palette(highlight); +} + +ads--CDockWidgetSideTab[sideTabBarArea="0"][activeTab="true"], +ads--CDockWidgetSideTab[sideTabBarArea="2"][activeTab="true"] { + border-top: 5px solid palette(highlight); +} + + +ads--CDockWidgetSideTab[sideTabBarArea="1"][activeTab="true"], +ads--CDockWidgetSideTab[sideTabBarArea="3"][activeTab="true"] { + border-bottom: 5px solid palette(highlight); +} + + +/***************************************************************************** + * CSideTabBar + *****************************************************************************/ +ads--CSideTabBar{ + background: palette(window); +} + + +ads--CSideTabBar[sideTabBarArea="0"] { + border-bottom: 1px solid palette(dark); +} + +ads--CSideTabBar[sideTabBarArea="1"] { + border-right: 1px solid palette(dark); +} + +ads--CSideTabBar[sideTabBarArea="2"] { + border-left: 1px solid palette(dark); +} + +ads--CSideTabBar[sideTabBarArea="3"] { + border-top: 1px solid palette(dark); +} + + +/***************************************************************************** + * CAutoHideDockContainer + *****************************************************************************/ +ads--CAutoHideDockContainer { + background: palette(window); +} + + +ads--CAutoHideDockContainer ads--CDockAreaTitleBar { + background: palette(highlight); + padding: 0px; + border: none; +} + + +/* + * This is required because the ads--CDockAreaWidget[focused="true"] will + * overwrite the ads--CAutoHideDockContainer ads--CDockAreaTitleBar rule + */ +ads--CAutoHideDockContainer ads--CDockAreaWidget[focused="true"] ads--CDockAreaTitleBar { + background: palette(highlight); + padding: 0px; + border: none; +} + + +#autoHideTitleLabel { + padding-left: 4px; + color: palette(light); +} + + +/***************************************************************************** + * CAutoHideDockContainer titlebar buttons + *****************************************************************************/ +#dockAreaAutoHideButton { + qproperty-icon: url(:/ads/images/vs-pin-button.svg); + qproperty-iconSize: 16px; +} + +ads--CAutoHideDockContainer #dockAreaAutoHideButton { + qproperty-icon: url(:/ads/images/vs-pin-button-pinned-focused.svg); + qproperty-iconSize: 16px; +} + + +ads--CAutoHideDockContainer #dockAreaCloseButton{ + qproperty-icon: url(:/ads/images/close-button-focused.svg) +} + + +ads--CAutoHideDockContainer ads--CTitleBarButton:hover { + background: rgba(255, 255, 255, 48); +} + +ads--CAutoHideDockContainer ads--CTitleBarButton:pressed { + background: rgba(255, 255, 255, 96); +} + +/***************************************************************************** + * CAutoHideDockContainer Titlebar and Buttons + *****************************************************************************/ + + +/***************************************************************************** + * CResizeHandle + *****************************************************************************/ +ads--CResizeHandle { + background: palette(window); +} + + +ads--CAutoHideDockContainer[sideTabBarArea="0"] ads--CResizeHandle { + border-top: 1px solid palette(dark); +} + +ads--CAutoHideDockContainer[sideTabBarArea="1"] ads--CResizeHandle { + border-left: 1px solid palette(dark); +} + +ads--CAutoHideDockContainer[sideTabBarArea="2"] ads--CResizeHandle { + border-right: 1px solid palette(dark); +} + +ads--CAutoHideDockContainer[sideTabBarArea="3"] ads--CResizeHandle { + border-top: 1px solid palette(dark); +} + + + diff --git a/src/stylesheets/focus_highlighting_linux.css b/src/stylesheets/focus_highlighting_linux.css index f16ab5e..dfa8a10 100644 --- a/src/stylesheets/focus_highlighting_linux.css +++ b/src/stylesheets/focus_highlighting_linux.css @@ -1,9 +1,18 @@ /* * Default style sheet on Linux Platforms with focus highlighting flag enabled */ + +/***************************************************************************** + * CDockContainerWidget + *****************************************************************************/ ads--CDockContainerWidget { - background: palette(dark); + background: palette(window); } + + +/***************************************************************************** + * CDockSplitter + *****************************************************************************/ ads--CDockContainerWidget > QSplitter{ padding: 1 0 1 0; } @@ -13,15 +22,64 @@ ads--CDockContainerWidget ads--CDockSplitter::handle { background: palette(dark); } + +/***************************************************************************** + * CDockAreaWidget + *****************************************************************************/ ads--CDockAreaWidget { background: palette(window); - border: 1px solid white; } ads--CDockAreaWidget #tabsMenuButton::menu-indicator { image: none; } + +ads--CTitleBarButton { + padding: 0px 0px; +} + + +#tabsMenuButton { + qproperty-icon: url(:/ads/images/tabs-menu-button.svg); + qproperty-iconSize: 16px; +} + + +#dockAreaCloseButton { + qproperty-icon: url(:/ads/images/close-button.svg), + url(:/ads/images/close-button-disabled.svg) disabled; + qproperty-iconSize: 16px; +} + + +#detachGroupButton { + qproperty-icon: url(:/ads/images/detach-button.svg), + url(:/ads/images/detach-button-disabled.svg) disabled; + qproperty-iconSize: 16px; +} + + + +/***************************************************************************** + * CDockAreaTitleBar + *****************************************************************************/ +ads--CDockAreaTitleBar { + background: transparent; + border-bottom: 2px solid palette(light); + padding-bottom: 0px; +} + +ads--CDockAreaWidget[focused="true"] ads--CDockAreaTitleBar { + background: transparent; + border-bottom: 2px solid palette(highlight); + padding-bottom: 0px; +} + + +/***************************************************************************** + * CDockWidgetTab and close button styling + *****************************************************************************/ ads--CDockWidgetTab { background: palette(window); border-color: palette(light); @@ -44,33 +102,6 @@ ads--CDockWidgetTab[activeTab="true"] QLabel { color: palette(foreground); } -ads--CDockWidget { - background: palette(light); - border-color: palette(light); - border-style: solid; - border-width: 1px 0 0 0; -} - -ads--CTitleBarButton { - padding: 0px 0px; -} - -QScrollArea#dockWidgetScrollArea { - padding: 0px; - border: none; -} - -#dockAreaCloseButton { - qproperty-icon: url(:/ads/images/close-button.svg), - url(:/ads/images/close-button-disabled.svg) disabled; - qproperty-iconSize: 16px; -} - -#detachGroupButton { - qproperty-icon: url(:/ads/images/detach-button.svg), - url(:/ads/images/detach-button-disabled.svg) disabled; - qproperty-iconSize: 16px; -} #tabCloseButton { margin-top: 2px; @@ -92,27 +123,21 @@ QScrollArea#dockWidgetScrollArea { } -#tabsMenuButton { - qproperty-icon: url(:/ads/images/tabs-menu-button.svg); - qproperty-iconSize: 16px; -} - - /* Focus related styling */ ads--CDockWidgetTab[focused="true"] { background: palette(highlight); border-color: palette(highlight); } -ads--CDockWidgetTab[focused="true"]>#tabCloseButton { +ads--CDockWidgetTab[focused="true"] > #tabCloseButton { qproperty-icon: url(:/ads/images/close-button-focused.svg) } -ads--CDockWidgetTab[focused="true"]>#tabCloseButton:hover { +ads--CDockWidgetTab[focused="true"] > #tabCloseButton:hover { background: rgba(255, 255, 255, 48); } -ads--CDockWidgetTab[focused="true"]>#tabCloseButton:pressed { +ads--CDockWidgetTab[focused="true"] > #tabCloseButton:pressed { background: rgba(255, 255, 255, 92); } @@ -120,19 +145,28 @@ ads--CDockWidgetTab[focused="true"] QLabel { color: palette(light); } -ads--CDockAreaTitleBar { - background: transparent; - border-bottom: 2px solid palette(light); - padding-bottom: 0px; -} -ads--CDockAreaWidget[focused="true"] ads--CDockAreaTitleBar { - background: transparent; - border-bottom: 2px solid palette(highlight); - padding-bottom: 0px; +/***************************************************************************** + * CDockWidget + *****************************************************************************/ +ads--CDockWidget { + background: palette(light); + border-color: palette(light); + border-style: solid; + border-width: 1px 0 0 0; } +QScrollArea#dockWidgetScrollArea { + padding: 0px; + border: none; +} + + + +/***************************************************************************** + * Floating widget styling + *****************************************************************************/ ads--CFloatingWidgetTitleBar { qproperty-maximizeIcon: url(:/ads/images/maximize-button.svg); qproperty-normalIcon: url(:/ads/images/restore-button.svg); @@ -197,3 +231,174 @@ ads--CFloatingDockContainer[isActiveWindow="true"] #floatingTitleMaximizeButton: } */ + +/***************************************************************************** + * + * Styling of auto hide functionality + * + *****************************************************************************/ + + +/***************************************************************************** + * CDockWidgetSideTab + *****************************************************************************/ +ads--CDockWidgetSideTab { + qproperty-iconSize: 16px 16px;/* this is optional in case you would like to change icon size*/ + padding-left: 2px; + padding-right: 0px; + text-align: center; + margin-right: 6px; + min-height: 20; + border: none; +} + +ads--CDockWidgetSideTab[sideTabBarArea="1"], +ads--CDockWidgetSideTab[sideTabBarArea="3"] { + border-bottom: 5px solid rgba(0, 0, 0, 48); +} + + +ads--CDockWidgetSideTab[sideTabBarArea="0"], +ads--CDockWidgetSideTab[sideTabBarArea="2"] { + border-top: 5px solid rgba(0, 0, 0, 48); +} + + +ads--CDockWidgetSideTab:hover[sideTabBarArea="0"], +ads--CDockWidgetSideTab:hover[sideTabBarArea="2"] { + border-top: 5px solid palette(highlight); + color: palette(highlight); +} + + +ads--CDockWidgetSideTab:hover[sideTabBarArea="1"], +ads--CDockWidgetSideTab:hover[sideTabBarArea="3"] { + border-bottom: 5px solid palette(highlight); + color: palette(highlight); +} + +ads--CDockWidgetSideTab[sideTabBarArea="0"][activeTab="true"], +ads--CDockWidgetSideTab[sideTabBarArea="2"][activeTab="true"] { + border-top: 5px solid palette(highlight); +} + + +ads--CDockWidgetSideTab[sideTabBarArea="1"][activeTab="true"], +ads--CDockWidgetSideTab[sideTabBarArea="3"][activeTab="true"] { + border-bottom: 5px solid palette(highlight); +} + + +/***************************************************************************** + * CSideTabBar + *****************************************************************************/ +ads--CSideTabBar{ + background: palette(window); +} + + +ads--CSideTabBar[sideTabBarArea="0"] { + border-bottom: 1px solid palette(dark); +} + +ads--CSideTabBar[sideTabBarArea="1"] { + border-right: 1px solid palette(dark); +} + +ads--CSideTabBar[sideTabBarArea="2"] { + border-left: 1px solid palette(dark); +} + +ads--CSideTabBar[sideTabBarArea="3"] { + border-top: 1px solid palette(dark); +} + + +/***************************************************************************** + * CAutoHideDockContainer + *****************************************************************************/ +ads--CAutoHideDockContainer { + background: palette(window); +} + + +ads--CAutoHideDockContainer ads--CDockAreaTitleBar { + background: palette(highlight); + padding: 0px; + border: none; +} + + +/* + * This is required because the ads--CDockAreaWidget[focused="true"] will + * overwrite the ads--CAutoHideDockContainer ads--CDockAreaTitleBar rule + */ +ads--CAutoHideDockContainer ads--CDockAreaWidget[focused="true"] ads--CDockAreaTitleBar { + background: palette(highlight); + padding: 0px; + border: none; +} + + +#autoHideTitleLabel { + padding-left: 4px; + color: palette(light); +} + + +/***************************************************************************** + * CAutoHideDockContainer titlebar buttons + *****************************************************************************/ +#dockAreaAutoHideButton { + qproperty-icon: url(:/ads/images/vs-pin-button.svg); + qproperty-iconSize: 16px; +} + +ads--CAutoHideDockContainer #dockAreaAutoHideButton { + qproperty-icon: url(:/ads/images/vs-pin-button-pinned-focused.svg); + qproperty-iconSize: 16px; +} + + +ads--CAutoHideDockContainer #dockAreaCloseButton{ + qproperty-icon: url(:/ads/images/close-button-focused.svg) +} + + +ads--CAutoHideDockContainer ads--CTitleBarButton:hover { + background: rgba(255, 255, 255, 48); +} + +ads--CAutoHideDockContainer ads--CTitleBarButton:pressed { + background: rgba(255, 255, 255, 96); +} + +/***************************************************************************** + * CAutoHideDockContainer Titlebar and Buttons + *****************************************************************************/ + + +/***************************************************************************** + * CResizeHandle + *****************************************************************************/ +ads--CResizeHandle { + background: palette(window); +} + + +ads--CAutoHideDockContainer[sideTabBarArea="0"] ads--CResizeHandle { + border-top: 1px solid palette(dark); +} + +ads--CAutoHideDockContainer[sideTabBarArea="1"] ads--CResizeHandle { + border-left: 1px solid palette(dark); +} + +ads--CAutoHideDockContainer[sideTabBarArea="2"] ads--CResizeHandle { + border-right: 1px solid palette(dark); +} + +ads--CAutoHideDockContainer[sideTabBarArea="3"] ads--CResizeHandle { + border-top: 1px solid palette(dark); +} + From af4a3ef2a8b3a01c4c518599a6169f29437ae63c Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Fri, 28 Oct 2022 15:52:52 +0200 Subject: [PATCH 12/22] Removed config flag CDockManager::AutoHideDockAreaHasTitle - this should not be configurable --- demo/MainWindow.cpp | 2 +- src/DockAreaWidget.cpp | 2 +- src/DockManager.h | 14 ++-- src/DockWidgetSideTab.cpp | 37 ++++++----- src/stylesheets/focus_highlighting.css | 92 ++++++++++++-------------- 5 files changed, 69 insertions(+), 78 deletions(-) diff --git a/demo/MainWindow.cpp b/demo/MainWindow.cpp index 733a9e8..ba5db06 100644 --- a/demo/MainWindow.cpp +++ b/demo/MainWindow.cpp @@ -654,7 +654,7 @@ CMainWindow::CMainWindow(QWidget *parent) : CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true); // uncomment if you would like to enable dock widget auto hiding - CDockManager::setConfigFlag(CDockManager::DefaultAutoHideConfig, true); + CDockManager::setConfigFlags(CDockManager::DefaultAutoHideConfig); // uncomment if you would like to enable an equal distribution of the // available size of a splitter to all contained dock widgets diff --git a/src/DockAreaWidget.cpp b/src/DockAreaWidget.cpp index fa66f85..db49d69 100644 --- a/src/DockAreaWidget.cpp +++ b/src/DockAreaWidget.cpp @@ -820,7 +820,7 @@ void CDockAreaWidget::updateTitleBarVisibility() d->TitleBar->setVisible(isAutoHide() ? true : !Hidden); // Titlebar must always be visible when auto hidden so it can be dragged auto tabBar = d->TitleBar->tabBar(); tabBar->setVisible(isAutoHide() ? false : !Hidden); // Never show tab bar when auto hidden - d->TitleBar->autoHideTitleLabel()->setVisible(CDockManager::testConfigFlag(CDockManager::AutoHideDockAreaHasTitle) && isAutoHide()); // Always show when auto hidden, never otherwise + d->TitleBar->autoHideTitleLabel()->setVisible(isAutoHide()); // Always show when auto hidden, never otherwise updateTitleBarButtonVisibility(Container->topLevelDockArea() == this); } } diff --git a/src/DockManager.h b/src/DockManager.h index 19ea2a0..74ba44a 100644 --- a/src/DockManager.h +++ b/src/DockManager.h @@ -230,17 +230,15 @@ public: { AutoHideFeatureEnabled = 0x01, DockAreaHasAutoHideButton = 0x02, //!< If the flag is set each dock area has a auto hide menu button - LeftSideBarPrioritizeIconOnly = 0x04, //!< If the flag is set left side bar will prioritize showing icons only over text - RightSideBarPrioritizeIconOnly = 0x08, //!< If the flag is set right side bar will prioritize showing icons only over text - BottomSideBarPrioritizeIconOnly = 0x10,//!< If the flag is set bottom side bar will prioritize showing icons only over text - TopSideBarPrioritizeIconOnly = 0x20, //!< If the flag is set top side bar will prioritize showing icons only over text - AutoHideDockAreaHasTitle = 0x40, //!< If the flag is set overlay dock area title bar will show the window title - AutoHideButtonTogglesArea = 0x80, //!< If the flag is set, the auto hide button enables auto hiding for all dock widgets in an area, if disabled, only the current dock widget will be toggled + LeftSideBarIconOnly = 0x04, //!< If the flag is set left side bar will show only icon if a the dock widget has an icon assigned + RightSideBarIconOnly = 0x08, //!< If the flag is set right side bar will show only icon if a the dock widget has an icon assigned + BottomSideBarIconOnly = 0x10,//!< If the flag is set bottom side show only icon if a the dock widget has an icon assigned + TopSideBarIconOnly = 0x20, //!< If the flag is set top side bar show only icon if a the dock widget has an icon assigned + AutoHideButtonTogglesArea = 0x40, //!< If the flag is set, the auto hide button enables auto hiding for all dock widgets in an area, if disabled, only the current dock widget will be toggled AutoHideButtonCheckable = 0x80, //!< If the flag is set, the auto hide button will be checked and unchecked depending on the auto hide state. Mainly for styling purposes. DefaultAutoHideConfig = AutoHideFeatureEnabled - | DockAreaHasAutoHideButton - | AutoHideDockAreaHasTitle, ///< the default configuration for left and right side bars + | DockAreaHasAutoHideButton ///< the default configuration for left and right side bars }; Q_DECLARE_FLAGS(AutoHideFlags, eAutoHideFlag) diff --git a/src/DockWidgetSideTab.cpp b/src/DockWidgetSideTab.cpp index 19cae32..bfc59b1 100644 --- a/src/DockWidgetSideTab.cpp +++ b/src/DockWidgetSideTab.cpp @@ -151,29 +151,30 @@ void CDockWidgetSideTab::updateOrientationForArea(SideBarLocation area) return; } - if (CDockManager::testConfigFlag(CDockManager::LeftSideBarPrioritizeIconOnly) && area == Left) + bool IconOnly = false; + switch (area) { - setText(""); - setOrientation(Qt::Horizontal); - return; + case SideBarLocation::Left: + IconOnly = CDockManager::testConfigFlag(CDockManager::LeftSideBarIconOnly); + break; + + case SideBarLocation::Right: + IconOnly = CDockManager::testConfigFlag(CDockManager::RightSideBarIconOnly); + break; + + case SideBarLocation::Top: + IconOnly = CDockManager::testConfigFlag(CDockManager::BottomSideBarIconOnly); + break; + + case SideBarLocation::Bottom: + IconOnly = CDockManager::testConfigFlag(CDockManager::TopSideBarIconOnly); + break; } - if (CDockManager::testConfigFlag(CDockManager::RightSideBarPrioritizeIconOnly) && area == Right) + + if (IconOnly) { setText(""); setOrientation(Qt::Horizontal); - return; - } - if (CDockManager::testConfigFlag(CDockManager::BottomSideBarPrioritizeIconOnly) && area == Bottom) - { - setText(""); - setOrientation(Qt::Horizontal); - return; - } - if (CDockManager::testConfigFlag(CDockManager::TopSideBarPrioritizeIconOnly) && area == Top) - { - setText(""); - setOrientation(Qt::Horizontal); - return; } } diff --git a/src/stylesheets/focus_highlighting.css b/src/stylesheets/focus_highlighting.css index d559716..34ece19 100644 --- a/src/stylesheets/focus_highlighting.css +++ b/src/stylesheets/focus_highlighting.css @@ -35,6 +35,39 @@ ads--CDockAreaWidget { } +ads--CDockAreaTitleBar { + background: transparent; + border-bottom: 2px solid palette(light); + padding-bottom: 0px; +} + +ads--CDockAreaWidget[focused="true"] ads--CDockAreaTitleBar { + border-bottom: 2px solid palette(highlight); +} + +ads--CTitleBarButton { + padding: 0px 0px; +} + + +#tabsMenuButton::menu-indicator { + image: none; +} + + +#dockAreaCloseButton { + qproperty-icon: url(:/ads/images/close-button.svg), + url(:/ads/images/close-button-disabled.svg) disabled; + qproperty-iconSize: 16px; +} + +#detachGroupButton { + qproperty-icon: url(:/ads/images/detach-button.svg), + url(:/ads/images/detach-button-disabled.svg) disabled; + qproperty-iconSize: 16px; +} + + /***************************************************************************** * CDockWidgetTab @@ -63,28 +96,6 @@ ads--CDockWidgetTab[activeTab="true"] QLabel { } - -/***************************************************************************** - * CDockWidget - *****************************************************************************/ -ads--CDockWidget { - background: palette(light); - border-color: palette(light); - border-style: solid; - border-width: 1px 0 0 0; -} - - -QScrollArea#dockWidgetScrollArea { - padding: 0px; - border: none; -} - - - -/***************************************************************************** - * Dock widget tab styling - *****************************************************************************/ #tabCloseButton { margin-top: 2px; background: none; @@ -129,38 +140,19 @@ ads--CDockWidgetTab[focused="true"] QLabel { /***************************************************************************** - * Dock area title bar and buttons styling + * CDockWidget *****************************************************************************/ - ads--CDockAreaTitleBar { - background: transparent; - border-bottom: 2px solid palette(light); - padding-bottom: 0px; -} - -ads--CDockAreaWidget[focused="true"] ads--CDockAreaTitleBar { - border-bottom: 2px solid palette(highlight); -} - -ads--CTitleBarButton { - padding: 0px 0px; +ads--CDockWidget { + background: palette(light); + border-color: palette(light); + border-style: solid; + border-width: 1px 0 0 0; } -#tabsMenuButton::menu-indicator { - image: none; -} - - -#dockAreaCloseButton { - qproperty-icon: url(:/ads/images/close-button.svg), - url(:/ads/images/close-button-disabled.svg) disabled; - qproperty-iconSize: 16px; -} - -#detachGroupButton { - qproperty-icon: url(:/ads/images/detach-button.svg), - url(:/ads/images/detach-button-disabled.svg) disabled; - qproperty-iconSize: 16px; +QScrollArea#dockWidgetScrollArea { + padding: 0px; + border: none; } From 8d670577a96a121466f85e04562996c1e5cfcb11 Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Fri, 28 Oct 2022 16:28:23 +0200 Subject: [PATCH 13/22] Moved creation of SideTabWidget into AutoHideDockContainer.cpp --- src/AutoHideDockContainer.cpp | 17 ++++++++++++++--- src/DockContainerWidget.cpp | 13 +++++++------ src/DockWidget.cpp | 3 ++- src/DockWidgetSideTab.cpp | 20 +++++++++++++++----- src/DockWidgetSideTab.h | 7 ++++++- src/SideTabBar.cpp | 22 ++++++++++------------ 6 files changed, 54 insertions(+), 28 deletions(-) diff --git a/src/AutoHideDockContainer.cpp b/src/AutoHideDockContainer.cpp index d3ba068..5f7a728 100644 --- a/src/AutoHideDockContainer.cpp +++ b/src/AutoHideDockContainer.cpp @@ -107,7 +107,7 @@ struct AutoHideDockContainerPrivate QBoxLayout* Layout; CResizeHandle* ResizeHandle = nullptr; QSize Size; // creates invalid size - CDockWidgetSideTab* SideTab = nullptr; + QPointer SideTab; /** * Private data constructor @@ -174,6 +174,8 @@ CAutoHideDockContainer::CAutoHideDockContainer(CDockManager* DockManager, SideBa d(new AutoHideDockContainerPrivate(this)) { d->SideTabBarArea = area; + d->SideTab = new CDockWidgetSideTab(); + connect(d->SideTab, &CDockWidgetSideTab::pressed, this, &CAutoHideDockContainer::toggleCollapseState); d->DockArea = new CDockAreaWidget(DockManager, parent); d->DockArea->setObjectName("autoHideDockArea"); d->DockArea->setAutoHideDockContainer(this); @@ -194,7 +196,6 @@ CAutoHideDockContainer::CAutoHideDockContainer(CDockManager* DockManager, SideBa d->Layout->insertWidget(resizeHandleLayoutPosition(area), d->ResizeHandle); d->Size = d->DockArea->size(); - updateSize(); parent->registerAutoHideWidget(this); } @@ -205,6 +206,7 @@ CAutoHideDockContainer::CAutoHideDockContainer(CDockWidget* DockWidget, SideBarL CAutoHideDockContainer(DockWidget->dockManager(), area, parent) { addDockWidget(DockWidget); + hide(); } @@ -292,7 +294,14 @@ void CAutoHideDockContainer::addDockWidget(CDockWidget* DockWidget) } d->DockWidget = DockWidget; - d->SideTab = DockWidget->sideTabWidget(); + if (!d->SideTab) + { + d->SideTab = DockWidget->sideTabWidget(); + } + else + { + d->SideTab->setDockWidget(DockWidget); + } CDockAreaWidget* OldDockArea = DockWidget->dockAreaWidget(); if (OldDockArea) { @@ -446,6 +455,8 @@ void CAutoHideDockContainer::toggleCollapseState() collapseView(isVisible()); } + +//============================================================================ void CAutoHideDockContainer::setSize(int width, int height) { d->Size = QSize(width, height); diff --git a/src/DockContainerWidget.cpp b/src/DockContainerWidget.cpp index d628ab3..95f865f 100644 --- a/src/DockContainerWidget.cpp +++ b/src/DockContainerWidget.cpp @@ -1535,25 +1535,26 @@ CDockAreaWidget* CDockContainerWidget::addDockWidget(DockWidgetArea area, CDockW CAutoHideDockContainer* CDockContainerWidget::createAndSetupAutoHideContainer( SideBarLocation area, CDockWidget* DockWidget, CDockWidget::eAutoHideInsertOrder insertOrder) { - if (d->DockManager != DockWidget->dockManager()) - { - DockWidget->setDockManager(d->DockManager); // Auto hide Dock Container needs a valid dock manager - } if (!CDockManager::testConfigFlag(CDockManager::AutoHideFeatureEnabled)) { Q_ASSERT_X(false, "CDockContainerWidget::createAndInitializeDockWidgetOverlayContainer", "Requested area does not exist in config"); return nullptr; } + if (d->DockManager != DockWidget->dockManager()) + { + DockWidget->setDockManager(d->DockManager); // Auto hide Dock Container needs a valid dock manager + } - sideTabBar(area)->insertSideTab(insertOrder == CDockWidget::First ? 0 : -1, DockWidget->sideTabWidget()); + /*sideTabBar(area)->insertSideTab(insertOrder == CDockWidget::First ? 0 : -1, DockWidget->sideTabWidget()); DockWidget->sideTabWidget()->show(); const auto AutoHideContainer = new CAutoHideDockContainer(DockWidget, area, this); AutoHideContainer->hide(); d->DockManager->dockFocusController()->clearDockWidgetFocus(DockWidget); + return AutoHideContainer;*/ - return AutoHideContainer; + return sideTabBar(area)->insertDockWidget(insertOrder == CDockWidget::First ? 0 : -1, DockWidget); } diff --git a/src/DockWidget.cpp b/src/DockWidget.cpp index 031be22..855eba8 100644 --- a/src/DockWidget.cpp +++ b/src/DockWidget.cpp @@ -325,7 +325,8 @@ CDockWidget::CDockWidget(const QString &title, QWidget *parent) : setObjectName(title); d->TabWidget = componentsFactory()->createDockWidgetTab(this); - d->SideTabWidget = componentsFactory()->createDockWidgetSideTab(this); + d->SideTabWidget = componentsFactory()->createDockWidgetSideTab(nullptr); + d->SideTabWidget->hide(); connect(d->SideTabWidget, &CDockWidgetSideTab::pressed, this, &CDockWidget::onDockWidgetSideTabClicked); diff --git a/src/DockWidgetSideTab.cpp b/src/DockWidgetSideTab.cpp index bfc59b1..4b90cdd 100644 --- a/src/DockWidgetSideTab.cpp +++ b/src/DockWidgetSideTab.cpp @@ -46,7 +46,7 @@ namespace ads struct DockWidgetSideTabPrivate { CDockWidgetSideTab* _this; - CDockWidget* DockWidget; + CDockWidget* DockWidget = nullptr; CSideTabBar* SideTabBar = nullptr; Qt::Orientation Orientation{Qt::Vertical}; @@ -84,13 +84,11 @@ void CDockWidgetSideTab::removeFromSideTabBar() } //============================================================================ -CDockWidgetSideTab::CDockWidgetSideTab(CDockWidget* DockWidget, QWidget* parent) : +CDockWidgetSideTab::CDockWidgetSideTab(QWidget* parent) : Super(parent), d(new DockWidgetSideTabPrivate(this)) { setAttribute(Qt::WA_NoMousePropagation); - d->DockWidget = DockWidget; - setText(DockWidget->windowTitle()); setFocusPolicy(Qt::NoFocus); } @@ -182,7 +180,7 @@ void CDockWidgetSideTab::updateOrientationForArea(SideBarLocation area) //============================================================================ bool CDockWidgetSideTab::isActiveTab() const { - if (d->DockWidget->autoHideDockContainer()) + if (d->DockWidget && d->DockWidget->autoHideDockContainer()) { return d->DockWidget->autoHideDockContainer()->isVisible(); } @@ -197,4 +195,16 @@ CDockWidget* CDockWidgetSideTab::dockWidget() const return d->DockWidget; } + +//============================================================================ +void CDockWidgetSideTab::setDockWidget(CDockWidget* DockWidget) +{ + if (!DockWidget) + { + return; + } + d->DockWidget = DockWidget; + setText(DockWidget->windowTitle()); +} + } diff --git a/src/DockWidgetSideTab.h b/src/DockWidgetSideTab.h index 4da3c75..04bdacd 100644 --- a/src/DockWidgetSideTab.h +++ b/src/DockWidgetSideTab.h @@ -76,7 +76,7 @@ public: * param[in] DockWidget The dock widget this title bar belongs to * param[in] parent The parent widget of this title bar */ - CDockWidgetSideTab(CDockWidget* DockWidget, QWidget* parent = nullptr); + CDockWidgetSideTab(QWidget* parent = nullptr); /** * Virtual Destructor @@ -117,6 +117,11 @@ public: * returns the dock widget this belongs to */ CDockWidget* dockWidget() const; + + /** + * Sets the dock widget that is controlled by this tab + */ + void setDockWidget(CDockWidget* DockWidget); }; // class DockWidgetSideTab } // namespace ads diff --git a/src/SideTabBar.cpp b/src/SideTabBar.cpp index d996ede..c1c0a19 100644 --- a/src/SideTabBar.cpp +++ b/src/SideTabBar.cpp @@ -139,21 +139,19 @@ void CSideTabBar::insertSideTab(int Index, CDockWidgetSideTab* SideTab) //============================================================================ CAutoHideDockContainer* CSideTabBar::insertDockWidget(int Index, CDockWidget* DockWidget) { - CDockWidgetSideTab* Tab = new CDockWidgetSideTab(DockWidget); - auto area = sideTabBarArea(); - qDebug() << "area " << area; - Tab->setSideTabBar(this); - Tab->updateOrientationForArea(area); - d->TabsLayout->insertWidget(Index, Tab); - Tab->show(); + /* + * sideTabBar(area)->insertSideTab(insertOrder == CDockWidget::First ? 0 : -1, DockWidget->sideTabWidget()); + DockWidget->sideTabWidget()->show(); - auto AutoHideContainer = new CAutoHideDockContainer(DockWidget, area, d->ContainerWidget); + const auto AutoHideContainer = new CAutoHideDockContainer(DockWidget, area, this); AutoHideContainer->hide(); - DockWidget->dockManager()->dockFocusController()->clearDockWidgetFocus(DockWidget); - Tab->updateStyle(); + d->DockManager->dockFocusController()->clearDockWidgetFocus(DockWidget); + return AutoHideContainer;*/ - connect(Tab, &CDockWidgetSideTab::pressed, AutoHideContainer, &CAutoHideDockContainer::toggleCollapseState); - show(); + auto AutoHideContainer = new CAutoHideDockContainer(DockWidget, d->SideTabArea, d->ContainerWidget); + DockWidget->dockManager()->dockFocusController()->clearDockWidgetFocus(DockWidget); + auto Tab = AutoHideContainer->sideTab(); + insertSideTab(Index, Tab); return AutoHideContainer; } From d1d801cf1695fbd111b732710b6f024dbecae98a Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Sun, 30 Oct 2022 19:44:33 +0100 Subject: [PATCH 14/22] Moved dock area restore code into CDockAreaWidget --- src/AutoHideDockContainer.cpp | 30 ++++----- src/DockAreaWidget.cpp | 93 +++++++++++++++++++++++++++ src/DockAreaWidget.h | 9 +++ src/DockContainerWidget.cpp | 118 +++++----------------------------- src/DockContainerWidget.h | 5 ++ src/DockWidget.cpp | 46 +++++++------ src/DockWidget.h | 26 +++++--- src/DockWidgetSideTab.cpp | 1 + src/SideTabBar.cpp | 29 +++++++++ src/SideTabBar.h | 9 +++ 10 files changed, 217 insertions(+), 149 deletions(-) diff --git a/src/AutoHideDockContainer.cpp b/src/AutoHideDockContainer.cpp index 5f7a728..267039c 100644 --- a/src/AutoHideDockContainer.cpp +++ b/src/AutoHideDockContainer.cpp @@ -27,14 +27,7 @@ //============================================================================ // INCLUDES //============================================================================ -#include -#include "DockManager.h" -#include "DockWidgetSideTab.h" -#include "DockWidgetTab.h" -#include "SideTabBar.h" -#include "DockAreaWidget.h" -#include "DockingStateReader.h" -#include "ResizeHandle.h" +#include "AutoHideDockContainer.h" #include #include @@ -43,6 +36,16 @@ #include #include +#include "DockManager.h" +#include "DockWidgetSideTab.h" +#include "DockWidgetTab.h" +#include "SideTabBar.h" +#include "DockAreaWidget.h" +#include "DockingStateReader.h" +#include "ResizeHandle.h" +#include "DockComponentsFactory.h" + + #include namespace ads @@ -174,7 +177,7 @@ CAutoHideDockContainer::CAutoHideDockContainer(CDockManager* DockManager, SideBa d(new AutoHideDockContainerPrivate(this)) { d->SideTabBarArea = area; - d->SideTab = new CDockWidgetSideTab(); + d->SideTab = componentsFactory()->createDockWidgetSideTab(nullptr); connect(d->SideTab, &CDockWidgetSideTab::pressed, this, &CAutoHideDockContainer::toggleCollapseState); d->DockArea = new CDockAreaWidget(DockManager, parent); d->DockArea->setObjectName("autoHideDockArea"); @@ -294,14 +297,7 @@ void CAutoHideDockContainer::addDockWidget(CDockWidget* DockWidget) } d->DockWidget = DockWidget; - if (!d->SideTab) - { - d->SideTab = DockWidget->sideTabWidget(); - } - else - { - d->SideTab->setDockWidget(DockWidget); - } + d->SideTab->setDockWidget(DockWidget); CDockAreaWidget* OldDockArea = DockWidget->dockAreaWidget(); if (OldDockArea) { diff --git a/src/DockAreaWidget.cpp b/src/DockAreaWidget.cpp index db49d69..4d47cb1 100644 --- a/src/DockAreaWidget.cpp +++ b/src/DockAreaWidget.cpp @@ -53,6 +53,7 @@ #include "DockComponentsFactory.h" #include "DockWidgetTab.h" #include "DockWidgetSideTab.h" +#include "DockingStateReader.h" namespace ads @@ -895,6 +896,98 @@ void CDockAreaWidget::saveState(QXmlStreamWriter& s) const } +//============================================================================ +bool CDockAreaWidget::restoreDockArea(CDockingStateReader& s, CDockAreaWidget*& CreatedWidget, + bool Testing, CDockContainerWidget* Container) +{ + bool Ok; +#ifdef ADS_DEBUG_PRINT + int Tabs = s.attributes().value("Tabs").toInt(&Ok); + if (!Ok) + { + return false; + } +#endif + + QString CurrentDockWidget = s.attributes().value("Current").toString(); + ADS_PRINT("Restore NodeDockArea Tabs: " << Tabs << " Current: " + << CurrentDockWidget); + + auto DockManager = Container->dockManager(); + CDockAreaWidget* DockArea = nullptr; + if (!Testing) + { + DockArea = new CDockAreaWidget(DockManager, Container); + const auto AllowedAreasAttribute = s.attributes().value("AllowedAreas"); + if (!AllowedAreasAttribute.isEmpty()) + { + DockArea->setAllowedAreas((DockWidgetArea)AllowedAreasAttribute.toInt(nullptr, 16)); + } + + const auto FlagsAttribute = s.attributes().value("Flags"); + if (!FlagsAttribute.isEmpty()) + { + DockArea->setDockAreaFlags((CDockAreaWidget::DockAreaFlags)FlagsAttribute.toInt(nullptr, 16)); + } + } + + while (s.readNextStartElement()) + { + if (s.name() != QLatin1String("Widget")) + { + continue; + } + + auto ObjectName = s.attributes().value("Name"); + if (ObjectName.isEmpty()) + { + return false; + } + + bool Closed = s.attributes().value("Closed").toInt(&Ok); + if (!Ok) + { + return false; + } + + s.skipCurrentElement(); + CDockWidget* DockWidget = DockManager->findDockWidget(ObjectName.toString()); + if (!DockWidget || Testing) + { + continue; + } + + ADS_PRINT("Dock Widget found - parent " << DockWidget->parent()); + // We hide the DockArea here to prevent the short display (the flashing) + // of the dock areas during application startup + DockArea->hide(); + DockArea->addDockWidget(DockWidget); + DockWidget->setToggleViewActionChecked(!Closed); + DockWidget->setClosedState(Closed); + DockWidget->setProperty(internal::ClosedProperty, Closed); + DockWidget->setProperty(internal::DirtyProperty, false); + } + + if (Testing) + { + return true; + } + + if (!DockArea->dockWidgetsCount()) + { + delete DockArea; + DockArea = nullptr; + } + else + { + DockArea->setProperty("currentDockWidget", CurrentDockWidget); + } + + CreatedWidget = DockArea; + return true; +} + + //============================================================================ CDockWidget* CDockAreaWidget::nextOpenDockWidget(CDockWidget* DockWidget) const { diff --git a/src/DockAreaWidget.h b/src/DockAreaWidget.h index 6a5b5f2..61862be 100644 --- a/src/DockAreaWidget.h +++ b/src/DockAreaWidget.h @@ -46,6 +46,7 @@ class CDockManager; class CDockContainerWidget; class DockContainerWidgetPrivate; class CDockAreaTitleBar; +class CDockingStateReader; /** @@ -296,6 +297,13 @@ public: */ void saveState(QXmlStreamWriter& Stream) const; + /** + * Restores a dock area. + * \see restoreChildNodes() for details + */ + static bool restoreDockArea(CDockingStateReader& Stream, CDockAreaWidget*& CreatedWidget, + bool Testing, CDockContainerWidget* Container); + /** * This functions returns the dock widget features of all dock widget in * this area. @@ -362,6 +370,7 @@ public: */ bool containsCentralWidget() const; + public Q_SLOTS: /** * This activates the tab for the given tab index. diff --git a/src/DockContainerWidget.cpp b/src/DockContainerWidget.cpp index 95f865f..f6c51b3 100644 --- a/src/DockContainerWidget.cpp +++ b/src/DockContainerWidget.cpp @@ -910,23 +910,7 @@ void DockContainerWidgetPrivate::saveAutoHideWidgetsState(QXmlStreamWriter& s) continue; } - s.writeStartElement("SideBar"); - s.writeAttribute("Area", QString::number(sideTabBar->sideTabBarArea())); - s.writeAttribute("Tabs", QString::number(sideTabBar->tabCount())); - - for (auto i = 0; i < sideTabBar->tabCount(); ++i) - { - auto Tab = sideTabBar->tabAt(i); - if (!Tab) - { - continue; - } - - auto DockArea = Tab->dockWidget()->dockAreaWidget(); - DockArea->saveState(s); - } - - s.writeEndElement(); + sideTabBar->saveState(s); } } @@ -1049,6 +1033,11 @@ bool DockContainerWidgetPrivate::restoreSplitter(CDockingStateReader& s, //============================================================================ bool DockContainerWidgetPrivate::restoreAutoHideDockArea(CDockingStateReader& s, SideBarLocation area, bool Testing) { + if (!CDockManager::testConfigFlag(CDockManager::AutoHideFeatureEnabled)) + { + return false; + } + bool Ok; #ifdef ADS_DEBUG_PRINT int Tabs = s.attributes().value("Tabs").toInt(&Ok); @@ -1062,11 +1051,6 @@ bool DockContainerWidgetPrivate::restoreAutoHideDockArea(CDockingStateReader& s, ADS_PRINT("Restore NodeDockArea Tabs: " << Tabs << " Current: " << CurrentDockWidget); - if (!CDockManager::testConfigFlag(CDockManager::AutoHideFeatureEnabled)) - { - return false; - } - CDockAreaWidget* DockArea = nullptr; CAutoHideDockContainer* AutoHideContainer = nullptr; if (!Testing) @@ -1136,91 +1120,14 @@ bool DockContainerWidgetPrivate::restoreAutoHideDockArea(CDockingStateReader& s, bool DockContainerWidgetPrivate::restoreDockArea(CDockingStateReader& s, QWidget*& CreatedWidget, bool Testing) { - bool Ok; -#ifdef ADS_DEBUG_PRINT - int Tabs = s.attributes().value("Tabs").toInt(&Ok); - if (!Ok) - { - return false; - } -#endif - - QString CurrentDockWidget = s.attributes().value("Current").toString(); - ADS_PRINT("Restore NodeDockArea Tabs: " << Tabs << " Current: " - << CurrentDockWidget); - CDockAreaWidget* DockArea = nullptr; - if (!Testing) + auto Result = CDockAreaWidget::restoreDockArea(s, DockArea, Testing, _this); + if (Result && DockArea) { - DockArea = new CDockAreaWidget(DockManager, _this); - const auto AllowedAreasAttribute = s.attributes().value("AllowedAreas"); - if (!AllowedAreasAttribute.isEmpty()) - { - DockArea->setAllowedAreas((DockWidgetArea)AllowedAreasAttribute.toInt(nullptr, 16)); - } - - const auto FlagsAttribute = s.attributes().value("Flags"); - if (!FlagsAttribute.isEmpty()) - { - DockArea->setDockAreaFlags((CDockAreaWidget::DockAreaFlags)FlagsAttribute.toInt(nullptr, 16)); - } - } - - while (s.readNextStartElement()) - { - if (s.name() != QLatin1String("Widget")) - { - continue; - } - - auto ObjectName = s.attributes().value("Name"); - if (ObjectName.isEmpty()) - { - return false; - } - - bool Closed = s.attributes().value("Closed").toInt(&Ok); - if (!Ok) - { - return false; - } - - s.skipCurrentElement(); - CDockWidget* DockWidget = DockManager->findDockWidget(ObjectName.toString()); - if (!DockWidget || Testing) - { - continue; - } - - ADS_PRINT("Dock Widget found - parent " << DockWidget->parent()); - // We hide the DockArea here to prevent the short display (the flashing) - // of the dock areas during application startup - DockArea->hide(); - DockArea->addDockWidget(DockWidget); - DockWidget->setToggleViewActionChecked(!Closed); - DockWidget->setClosedState(Closed); - DockWidget->setProperty(internal::ClosedProperty, Closed); - DockWidget->setProperty(internal::DirtyProperty, false); - } - - if (Testing) - { - return true; - } - - if (!DockArea->dockWidgetsCount()) - { - delete DockArea; - DockArea = nullptr; - } - else - { - DockArea->setProperty("currentDockWidget", CurrentDockWidget); appendDockAreas({DockArea}); } - CreatedWidget = DockArea; - return true; + return Result; } @@ -2319,6 +2226,13 @@ QRect CDockContainerWidget::contentRectGlobal() const } return internal::globalGeometry(d->RootSplitter); } + + +//=========================================================================== +CDockManager* CDockContainerWidget::dockManager() const +{ + return d->DockManager; +} } // namespace ads //--------------------------------------------------------------------------- diff --git a/src/DockContainerWidget.h b/src/DockContainerWidget.h index 709d555..b97783a 100644 --- a/src/DockContainerWidget.h +++ b/src/DockContainerWidget.h @@ -342,6 +342,11 @@ public: */ QRect contentRectGlobal() const; + /** + * Returns the dock manager that owns this container + */ + CDockManager* dockManager() const; + Q_SIGNALS: /** diff --git a/src/DockWidget.cpp b/src/DockWidget.cpp index 855eba8..529bd1a 100644 --- a/src/DockWidget.cpp +++ b/src/DockWidget.cpp @@ -325,10 +325,6 @@ CDockWidget::CDockWidget(const QString &title, QWidget *parent) : setObjectName(title); d->TabWidget = componentsFactory()->createDockWidgetTab(this); - d->SideTabWidget = componentsFactory()->createDockWidgetSideTab(nullptr); - d->SideTabWidget->hide(); - - connect(d->SideTabWidget, &CDockWidgetSideTab::pressed, this, &CDockWidget::onDockWidgetSideTabClicked); d->ToggleViewAction = new QAction(title, this); d->ToggleViewAction->setCheckable(true); @@ -346,10 +342,6 @@ CDockWidget::CDockWidget(const QString &title, QWidget *parent) : CDockWidget::~CDockWidget() { ADS_PRINT("~CDockWidget()"); - if (d->SideTabWidget) - { - delete d->SideTabWidget; - } delete d; } @@ -443,6 +435,8 @@ CDockWidgetTab* CDockWidget::tabWidget() const return d->TabWidget; } + +//============================================================================ CAutoHideDockContainer* CDockWidget::autoHideDockContainer() const { if (!d->DockArea) @@ -534,6 +528,20 @@ CDockWidgetSideTab* CDockWidget::sideTabWidget() const } +//============================================================================ +void CDockWidget::setSideTabWidget(CDockWidgetSideTab* SideTab) const +{ + d->SideTabWidget = SideTab; +} + + +//============================================================================ +bool CDockWidget::isAutoHide() const +{ + return !d->SideTabWidget.isNull(); +} + + //============================================================================ bool CDockWidget::isFloating() const { @@ -741,6 +749,10 @@ bool CDockWidget::event(QEvent *e) { d->TabWidget->setText(title); } + if (d->SideTabWidget) + { + d->SideTabWidget->setText(title); + } if (d->ToggleViewAction) { d->ToggleViewAction->setText(title); @@ -791,7 +803,12 @@ void CDockWidget::setTabToolTip(const QString &text) void CDockWidget::setIcon(const QIcon& Icon) { d->TabWidget->setIcon(Icon); - d->SideTabWidget->setIcon(Icon); + + if (d->SideTabWidget) + { + d->SideTabWidget->setIcon(Icon); + } + if (!d->ToggleViewAction->isCheckable()) { d->ToggleViewAction->setIcon(Icon); @@ -1082,17 +1099,6 @@ void CDockWidget::showNormal() } } -//============================================================================ -void CDockWidget::onDockWidgetSideTabClicked() -{ - const auto autoHideContainer = autoHideDockContainer(); - if (!autoHideContainer) - { - return; - } - - autoHideContainer->toggleCollapseState(); -} //============================================================================ bool CDockWidget::isFullScreen() const diff --git a/src/DockWidget.h b/src/DockWidget.h index 52d87b2..ae8852c 100644 --- a/src/DockWidget.h +++ b/src/DockWidget.h @@ -315,12 +315,6 @@ public: */ CDockWidgetTab* tabWidget() const; - /** - * Returns the auto hide dock container of this dock widget - * or 0 if there is none - */ - CAutoHideDockContainer* autoHideDockContainer() const; - /** * Sets, whether the dock widget is movable, closable, and floatable. */ @@ -371,6 +365,22 @@ public: */ CDockWidgetSideTab* sideTabWidget() const; + /** + * Assign a side tab widget if this dock widget is an auto hide container + */ + void setSideTabWidget(CDockWidgetSideTab* SideTab) const; + + /** + * Returns true, if this dock widget is in an auto hide container + */ + bool isAutoHide() const; + + /** + * Returns the auto hide dock container of this dock widget + * or 0 if there is none + */ + CAutoHideDockContainer* autoHideDockContainer() const; + /** * This property holds whether the dock widget is floating. * A dock widget is only floating, if it is the one and only widget inside @@ -613,10 +623,6 @@ public Q_SLOTS: */ void showNormal(); - /** - * Toggles the dock auto hide container when the side tab is clicked - */ - void onDockWidgetSideTabClicked(); Q_SIGNALS: /** diff --git a/src/DockWidgetSideTab.cpp b/src/DockWidgetSideTab.cpp index 4b90cdd..29e8ccc 100644 --- a/src/DockWidgetSideTab.cpp +++ b/src/DockWidgetSideTab.cpp @@ -205,6 +205,7 @@ void CDockWidgetSideTab::setDockWidget(CDockWidget* DockWidget) } d->DockWidget = DockWidget; setText(DockWidget->windowTitle()); + setIcon(d->DockWidget->icon()); } } diff --git a/src/SideTabBar.cpp b/src/SideTabBar.cpp index c1c0a19..8c7296d 100644 --- a/src/SideTabBar.cpp +++ b/src/SideTabBar.cpp @@ -34,12 +34,14 @@ #include #include #include +#include #include "DockContainerWidget.h" #include "DockWidgetSideTab.h" #include "DockWidgetTab.h" #include "DockFocusController.h" #include "AutoHideDockContainer.h" +#include "DockAreaWidget.h" namespace ads { @@ -274,4 +276,31 @@ SideBarLocation CSideTabBar::sideTabBarArea() const return d->SideTabArea; } + +//============================================================================ +void CSideTabBar::saveState(QXmlStreamWriter& s) const +{ + if (!tabCount()) + { + return; + } + + s.writeStartElement("SideBar"); + s.writeAttribute("Area", QString::number(sideTabBarArea())); + s.writeAttribute("Tabs", QString::number(tabCount())); + + for (auto i = 0; i < tabCount(); ++i) + { + auto Tab = tabAt(i); + if (!Tab) + { + continue; + } + + auto DockArea = Tab->dockWidget()->dockAreaWidget(); + DockArea->saveState(s); + } + + s.writeEndElement(); +} } diff --git a/src/SideTabBar.h b/src/SideTabBar.h index 4ba757a..585be39 100644 --- a/src/SideTabBar.h +++ b/src/SideTabBar.h @@ -33,9 +33,12 @@ #include "DockWidgetSideTab.h" #include "ads_globals.h" +class QXmlStreamWriter; + namespace ads { struct SideTabBarPrivate; +class DockContainerWidgetPrivate; class CDockContainerWidget; class CDockWidgetSideTab; class CAutoHideDockContainer; @@ -57,12 +60,18 @@ private: SideTabBarPrivate* d; ///< private data (pimpl) friend struct SideTabBarPrivate; friend class DockWidgetSideTab; + friend DockContainerWidgetPrivate; protected: virtual void paintEvent(QPaintEvent* event) override; virtual bool event(QEvent* e) override; virtual bool eventFilter(QObject *watched, QEvent *event) override; + /** + * Saves the state into the given stream + */ + void saveState(QXmlStreamWriter& Stream) const; + public: using Super = QFrame; From 44790307d80199d0456add407993e01a623d31f8 Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Tue, 1 Nov 2022 11:02:01 +0100 Subject: [PATCH 15/22] Properly implemented restore functionality for auto hide container --- examples/autohide/mainwindow.cpp | 2 +- src/AutoHideDockContainer.cpp | 64 ++++++-------- src/AutoHideDockContainer.h | 35 ++++---- src/DockAreaWidget.cpp | 9 +- src/DockAreaWidget.h | 4 +- src/DockContainerWidget.cpp | 143 ++++++++----------------------- src/DockManager.cpp | 3 +- src/DockWidget.h | 2 + src/DockWidgetSideTab.cpp | 1 - src/SideTabBar.cpp | 17 ++-- src/SideTabBar.h | 1 + 11 files changed, 95 insertions(+), 186 deletions(-) diff --git a/examples/autohide/mainwindow.cpp b/examples/autohide/mainwindow.cpp index 42dc49c..30061aa 100644 --- a/examples/autohide/mainwindow.cpp +++ b/examples/autohide/mainwindow.cpp @@ -47,7 +47,7 @@ CMainWindow::CMainWindow(QWidget *parent) TableDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget); TableDockWidget->setMinimumSize(200,150); const auto autoHideContainer = DockManager->addAutoHideDockWidget(SideBarLocation::Left, TableDockWidget, CDockWidget::Last); - autoHideContainer->setSize(480, 100); + autoHideContainer->setSize(480); ui->menuView->addAction(TableDockWidget->toggleViewAction()); table = new QTableWidget(); diff --git a/src/AutoHideDockContainer.cpp b/src/AutoHideDockContainer.cpp index 267039c..936782c 100644 --- a/src/AutoHideDockContainer.cpp +++ b/src/AutoHideDockContainer.cpp @@ -167,7 +167,14 @@ AutoHideDockContainerPrivate::AutoHideDockContainerPrivate( //============================================================================ CDockContainerWidget* CAutoHideDockContainer::parentContainer() const { - return internal::findParent(this); + if (d->DockArea) + { + return d->DockArea->dockContainer(); + } + else + { + return internal::findParent(this); + } } @@ -176,6 +183,7 @@ CAutoHideDockContainer::CAutoHideDockContainer(CDockManager* DockManager, SideBa Super(parent), d(new AutoHideDockContainerPrivate(this)) { + hide(); // auto hide dock container is initially always hidden d->SideTabBarArea = area; d->SideTab = componentsFactory()->createDockWidgetSideTab(nullptr); connect(d->SideTab, &CDockWidgetSideTab::pressed, this, &CAutoHideDockContainer::toggleCollapseState); @@ -363,40 +371,11 @@ void CAutoHideDockContainer::cleanupAndDelete() //============================================================================ void CAutoHideDockContainer::saveState(QXmlStreamWriter& s) { + s.writeStartElement("Widget"); + s.writeAttribute("Name", d->DockWidget->objectName()); + s.writeAttribute("Closed", QString::number(d->DockWidget->isClosed() ? 1 : 0)); s.writeAttribute("Size", QString::number(d->isHorizontal() ? d->Size.height() : d->Size.width())); - - qDebug() << ": saveState Size: " << d->Size; - qDebug() << ": saveState Size " << QString::number(d->isHorizontal() ? d->Size.height() : d->Size.width()); -} - - -//============================================================================ -bool CAutoHideDockContainer::restoreState(CDockingStateReader& s, bool Testing) -{ - bool ok; - int Size = s.attributes().value("Size").toInt(&ok); - if (!ok) - { - return false; - } - - if (Testing) - { - return true; - } - - if (d->isHorizontal()) - { - d->Size.setHeight(Size); - } - else - { - d->Size.setWidth(Size); - qDebug() << ": restoreState Width " << Size; - } - - qDebug() << ": restoreState Size: " << d->Size; - return true; + s.writeEndElement(); } @@ -438,6 +417,11 @@ void CAutoHideDockContainer::collapseView(bool Enable) show(); d->DockWidget->dockManager()->setDockWidgetFocused(d->DockWidget); qApp->installEventFilter(this); + + qDebug() << "CAutoHideDockContainer.hidden " << this->isHidden(); + qDebug() << "d->DockArea->isHidden() " << d->DockArea->isHidden(); + qDebug() << "d->DockWidget->isHidden() " << d->DockWidget->isHidden(); + qDebug() << "CAutoHideDockContainer.geometry() " << this->geometry(); } ADS_PRINT("CAutoHideDockContainer::collapseView " << Enable); @@ -453,9 +437,17 @@ void CAutoHideDockContainer::toggleCollapseState() //============================================================================ -void CAutoHideDockContainer::setSize(int width, int height) +void CAutoHideDockContainer::setSize(int Size) { - d->Size = QSize(width, height); + if (d->isHorizontal()) + { + d->Size.setHeight(Size); + } + else + { + d->Size.setWidth(Size); + } + updateSize(); } diff --git a/src/AutoHideDockContainer.h b/src/AutoHideDockContainer.h index 3a6b8c7..eb93cf2 100644 --- a/src/AutoHideDockContainer.h +++ b/src/AutoHideDockContainer.h @@ -46,6 +46,7 @@ class CDockContainerWidget; class CSideTabBar; class CDockAreaWidget; class CDockingStateReader; +struct SideTabBarPrivate; /** * Auto hide container for hosting an auto hide dock widget @@ -57,13 +58,18 @@ class ADS_EXPORT CAutoHideDockContainer : public QFrame private: AutoHideDockContainerPrivate* d; ///< private data (pimpl) friend struct AutoHideDockContainerPrivate; + friend CSideTabBar; + friend SideTabBarPrivate; protected: bool eventFilter(QObject* watched, QEvent* event) override; void resizeEvent(QResizeEvent* event) override; void updateSize(); - CDockContainerWidget* parentContainer() const; + /* + * Saves the state and size + */ + void saveState(QXmlStreamWriter& Stream); public: using Super = QFrame; @@ -114,6 +120,11 @@ public: */ CDockAreaWidget* dockAreaWidget() const; + /** + * Returns the parent container that hosts this auto hide container + */ + CDockContainerWidget* parentContainer() const; + /** * Moves the contents to the parent container widget * Used before removing this Auto Hide dock container @@ -125,16 +136,6 @@ public: */ void cleanupAndDelete(); - /* - * Saves the state and size - */ - void saveState(QXmlStreamWriter& Stream); - - /* - * Restores the size of the splitter - */ - bool restoreState(CDockingStateReader& Stream, bool Testing); - /* * Toggles the auto Hide dock container widget * This will also hide the side tab widget @@ -153,13 +154,13 @@ public: void toggleCollapseState(); /** - * Use this instead of resize. This will ensure the size is consistent internally. - * E.g. If you set a height less than the parent height when it's vertical - * It will simply be rescaled to the parent height while the width will be resized + * Use this instead of resize. + * Depending on the sidebar location this will set the width or heigth + * of this auto hide container. */ - void setSize(int width, int height); + void setSize(int Size); }; -} - +} // namespace ads +//----------------------------------------------------------------------------- #endif diff --git a/src/DockAreaWidget.cpp b/src/DockAreaWidget.cpp index 4d47cb1..adaad98 100644 --- a/src/DockAreaWidget.cpp +++ b/src/DockAreaWidget.cpp @@ -870,13 +870,6 @@ void CDockAreaWidget::saveState(QXmlStreamWriter& s) const QString Name = CurrentDockWidget ? CurrentDockWidget->objectName() : ""; s.writeAttribute("Current", Name); - // To keep the saved XML data small, we only save the allowed areas and the - // dock area flags if the values are different from the default values - if (isAutoHide()) - { - autoHideDockContainer()->saveState(s); - } - if (d->AllowedAreas != DefaultAllowedAreas) { s.writeAttribute("AllowedAreas", QString::number(d->AllowedAreas, 16)); @@ -897,7 +890,7 @@ void CDockAreaWidget::saveState(QXmlStreamWriter& s) const //============================================================================ -bool CDockAreaWidget::restoreDockArea(CDockingStateReader& s, CDockAreaWidget*& CreatedWidget, +bool CDockAreaWidget::restoreState(CDockingStateReader& s, CDockAreaWidget*& CreatedWidget, bool Testing, CDockContainerWidget* Container) { bool Ok; diff --git a/src/DockAreaWidget.h b/src/DockAreaWidget.h index 61862be..edb1b02 100644 --- a/src/DockAreaWidget.h +++ b/src/DockAreaWidget.h @@ -301,8 +301,8 @@ public: * Restores a dock area. * \see restoreChildNodes() for details */ - static bool restoreDockArea(CDockingStateReader& Stream, CDockAreaWidget*& CreatedWidget, - bool Testing, CDockContainerWidget* Container); + static bool restoreState(CDockingStateReader& Stream, CDockAreaWidget*& CreatedWidget, + bool Testing, CDockContainerWidget* ParentContainer); /** * This functions returns the dock widget features of all dock widget in diff --git a/src/DockContainerWidget.cpp b/src/DockContainerWidget.cpp index f6c51b3..2569539 100644 --- a/src/DockContainerWidget.cpp +++ b/src/DockContainerWidget.cpp @@ -250,13 +250,6 @@ public: bool restoreDockArea(CDockingStateReader& Stream, QWidget*& CreatedWidget, bool Testing); - /** - * Restores the auto hide dock area. - * Assumes that there are no auto hidden dock areas, and then restores all the dock areas that - * exist in the XML - */ - bool restoreAutoHideDockArea(CDockingStateReader& s, SideBarLocation area, bool Testing); - /** * Restores a auto hide side bar */ @@ -1030,98 +1023,13 @@ bool DockContainerWidgetPrivate::restoreSplitter(CDockingStateReader& s, return true; } -//============================================================================ -bool DockContainerWidgetPrivate::restoreAutoHideDockArea(CDockingStateReader& s, SideBarLocation area, bool Testing) -{ - if (!CDockManager::testConfigFlag(CDockManager::AutoHideFeatureEnabled)) - { - return false; - } - - bool Ok; -#ifdef ADS_DEBUG_PRINT - int Tabs = s.attributes().value("Tabs").toInt(&Ok); - if (!Ok) - { - return false; - } -#endif - - QString CurrentDockWidget = s.attributes().value("Current").toString(); - ADS_PRINT("Restore NodeDockArea Tabs: " << Tabs << " Current: " - << CurrentDockWidget); - - CDockAreaWidget* DockArea = nullptr; - CAutoHideDockContainer* AutoHideContainer = nullptr; - if (!Testing) - { - AutoHideContainer = new CAutoHideDockContainer(DockManager, area, _this); - if (!AutoHideContainer->restoreState(s, Testing)) - { - return false; - } - - AutoHideContainer->hide(); - DockArea = AutoHideContainer->dockAreaWidget(); - DockArea->updateAutoHideButtonCheckState(); - DockArea->updateTitleBarButtonToolTip(); - } - - while (s.readNextStartElement()) - { - if (s.name() != QLatin1String("Widget")) - { - continue; - } - - auto ObjectName = s.attributes().value("Name"); - if (ObjectName.isEmpty()) - { - return false; - } - - bool Closed = s.attributes().value("Closed").toInt(&Ok); - if (!Ok) - { - return false; - } - - s.skipCurrentElement(); - CDockWidget* DockWidget = DockManager->findDockWidget(ObjectName.toString()); - if (!DockWidget || Testing) - { - continue; - } - - ADS_PRINT("Dock Widget found - parent " << DockWidget->parent()); - // We hide the DockArea here to prevent the short display (the flashing) - // of the dock areas during application startup - DockArea->hide(); - DockWidget->setToggleViewActionChecked(!Closed); - DockWidget->setClosedState(Closed); - DockWidget->setProperty(internal::ClosedProperty, Closed); - DockWidget->setProperty(internal::DirtyProperty, false); - _this->sideTabBar(area)->insertSideTab(-1, DockWidget->sideTabWidget()); - DockArea->autoHideDockContainer()->addDockWidget(DockWidget); - DockWidget->sideTabWidget()->updateStyle(); // Needed as the side tab widget get it's left/right property from the overlay dock container which was just added - DockArea->autoHideDockContainer()->toggleView(!Closed); - } - - if (AutoHideContainer && !AutoHideContainer->dockWidget()) - { - AutoHideContainer->cleanupAndDelete(); - } - - return true; -} - //============================================================================ bool DockContainerWidgetPrivate::restoreDockArea(CDockingStateReader& s, QWidget*& CreatedWidget, bool Testing) { CDockAreaWidget* DockArea = nullptr; - auto Result = CDockAreaWidget::restoreDockArea(s, DockArea, Testing, _this); + auto Result = CDockAreaWidget::restoreState(s, DockArea, Testing, _this); if (Result && DockArea) { appendDockAreas({DockArea}); @@ -1136,14 +1044,14 @@ bool DockContainerWidgetPrivate::restoreSideBar(CDockingStateReader& s, QWidget*& CreatedWidget, bool Testing) { Q_UNUSED(CreatedWidget) - // Simply ignore side bar auto hide widgets + // Simply ignore side bar auto hide widgets from saved state if + // auto hide support is disabled if (!CDockManager::testConfigFlag(CDockManager::AutoHideFeatureEnabled)) { return true; } bool Ok; - //int Tabs = s.attributes().value("Tabs").toInt(&Ok); auto Area = (ads::SideBarLocation)s.attributes().value("Area").toInt(&Ok); if (!Ok) { @@ -1152,15 +1060,42 @@ bool DockContainerWidgetPrivate::restoreSideBar(CDockingStateReader& s, while (s.readNextStartElement()) { - if (s.name() != QLatin1String("Area")) + if (s.name() != QLatin1String("Widget")) { continue; } - if (!restoreAutoHideDockArea(s, Area, Testing)) - { - return false; - } + auto Name = s.attributes().value("Name"); + if (Name.isEmpty()) + { + return false; + } + + bool Ok; + bool Closed = s.attributes().value("Closed").toInt(&Ok); + if (!Ok) + { + return false; + } + + int Size = s.attributes().value("Size").toInt(&Ok); + if (!Ok) + { + return false; + } + + s.skipCurrentElement(); + CDockWidget* DockWidget = DockManager->findDockWidget(Name.toString()); + if (!DockWidget || Testing) + { + continue; + } + + auto SideBar = _this->sideTabBar(Area); + auto AutoHideContainer = SideBar->insertDockWidget(-1, DockWidget); + AutoHideContainer->setSize(Size); + DockWidget->setProperty(internal::ClosedProperty, Closed); + DockWidget->setProperty(internal::DirtyProperty, false); } return true; @@ -1453,14 +1388,6 @@ CAutoHideDockContainer* CDockContainerWidget::createAndSetupAutoHideContainer( DockWidget->setDockManager(d->DockManager); // Auto hide Dock Container needs a valid dock manager } - /*sideTabBar(area)->insertSideTab(insertOrder == CDockWidget::First ? 0 : -1, DockWidget->sideTabWidget()); - DockWidget->sideTabWidget()->show(); - - const auto AutoHideContainer = new CAutoHideDockContainer(DockWidget, area, this); - AutoHideContainer->hide(); - d->DockManager->dockFocusController()->clearDockWidgetFocus(DockWidget); - return AutoHideContainer;*/ - return sideTabBar(area)->insertDockWidget(insertOrder == CDockWidget::First ? 0 : -1, DockWidget); } diff --git a/src/DockManager.cpp b/src/DockManager.cpp index cb55869..5899192 100644 --- a/src/DockManager.cpp +++ b/src/DockManager.cpp @@ -700,7 +700,8 @@ QByteArray CDockManager::saveState(int version) const QByteArray xmldata; QXmlStreamWriter s(&xmldata); auto ConfigFlags = CDockManager::configFlags(); - s.setAutoFormatting(ConfigFlags.testFlag(XmlAutoFormattingEnabled)); + //s.setAutoFormatting(ConfigFlags.testFlag(XmlAutoFormattingEnabled)); + s.setAutoFormatting(true); s.writeStartDocument(); s.writeStartElement("QtAdvancedDockingSystem"); s.writeAttribute("Version", QString::number(CurrentVersion)); diff --git a/src/DockWidget.h b/src/DockWidget.h index ae8852c..d8048a2 100644 --- a/src/DockWidget.h +++ b/src/DockWidget.h @@ -48,6 +48,7 @@ class DockContainerWidgetPrivate; class CFloatingDockContainer; class CDockWidgetSideTab; class CAutoHideDockContainer; +class CSideTabBar; /** * The QDockWidget class provides a widget that can be docked inside a @@ -78,6 +79,7 @@ protected: friend struct DockWidgetTabPrivate; friend struct DockAreaTitleBarPrivate; friend class CAutoHideDockContainer; + friend CSideTabBar; /** * Assigns the dock manager that manages this dock widget diff --git a/src/DockWidgetSideTab.cpp b/src/DockWidgetSideTab.cpp index 29e8ccc..c7c1b1a 100644 --- a/src/DockWidgetSideTab.cpp +++ b/src/DockWidgetSideTab.cpp @@ -114,7 +114,6 @@ SideBarLocation CDockWidgetSideTab::sideTabBarArea() const { if (d->SideTabBar) { - qDebug() << "CDockWidgetSideTab::sideTabBarArea() " << d->SideTabBar->sideTabBarArea(); return d->SideTabBar->sideTabBarArea(); } diff --git a/src/SideTabBar.cpp b/src/SideTabBar.cpp index 8c7296d..8ee67a3 100644 --- a/src/SideTabBar.cpp +++ b/src/SideTabBar.cpp @@ -42,6 +42,7 @@ #include "DockFocusController.h" #include "AutoHideDockContainer.h" #include "DockAreaWidget.h" +#include "DockingStateReader.h" namespace ads { @@ -141,15 +142,6 @@ void CSideTabBar::insertSideTab(int Index, CDockWidgetSideTab* SideTab) //============================================================================ CAutoHideDockContainer* CSideTabBar::insertDockWidget(int Index, CDockWidget* DockWidget) { - /* - * sideTabBar(area)->insertSideTab(insertOrder == CDockWidget::First ? 0 : -1, DockWidget->sideTabWidget()); - DockWidget->sideTabWidget()->show(); - - const auto AutoHideContainer = new CAutoHideDockContainer(DockWidget, area, this); - AutoHideContainer->hide(); - d->DockManager->dockFocusController()->clearDockWidgetFocus(DockWidget); - return AutoHideContainer;*/ - auto AutoHideContainer = new CAutoHideDockContainer(DockWidget, d->SideTabArea, d->ContainerWidget); DockWidget->dockManager()->dockFocusController()->clearDockWidgetFocus(DockWidget); auto Tab = AutoHideContainer->sideTab(); @@ -297,10 +289,11 @@ void CSideTabBar::saveState(QXmlStreamWriter& s) const continue; } - auto DockArea = Tab->dockWidget()->dockAreaWidget(); - DockArea->saveState(s); + Tab->dockWidget()->autoHideDockContainer()->saveState(s); } s.writeEndElement(); } -} + + +} // namespace ads diff --git a/src/SideTabBar.h b/src/SideTabBar.h index 585be39..f11e3e3 100644 --- a/src/SideTabBar.h +++ b/src/SideTabBar.h @@ -42,6 +42,7 @@ class DockContainerWidgetPrivate; class CDockContainerWidget; class CDockWidgetSideTab; class CAutoHideDockContainer; +class CDockingStateReader; /** * Side tab bar widget that is shown at the edges of a dock container. From fba9c7ce5d665e274b14ca9f875035e2e59f0b39 Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Tue, 1 Nov 2022 11:22:15 +0100 Subject: [PATCH 16/22] Create auto hide sidebars only if config flag is set --- src/AutoHideDockContainer.cpp | 6 ------ src/DockAreaWidget.cpp | 1 - src/DockContainerWidget.cpp | 14 +++++++------- src/SideTabBar.cpp | 2 +- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/AutoHideDockContainer.cpp b/src/AutoHideDockContainer.cpp index 936782c..08370a3 100644 --- a/src/AutoHideDockContainer.cpp +++ b/src/AutoHideDockContainer.cpp @@ -262,7 +262,6 @@ void CAutoHideDockContainer::updateSize() //============================================================================ CAutoHideDockContainer::~CAutoHideDockContainer() { - qDebug() << "~CAutoHideDockContainer()" ADS_PRINT("~CAutoHideDockContainer"); // Remove event filter in case there are any queued messages @@ -417,11 +416,6 @@ void CAutoHideDockContainer::collapseView(bool Enable) show(); d->DockWidget->dockManager()->setDockWidgetFocused(d->DockWidget); qApp->installEventFilter(this); - - qDebug() << "CAutoHideDockContainer.hidden " << this->isHidden(); - qDebug() << "d->DockArea->isHidden() " << d->DockArea->isHidden(); - qDebug() << "d->DockWidget->isHidden() " << d->DockWidget->isHidden(); - qDebug() << "CAutoHideDockContainer.geometry() " << this->geometry(); } ADS_PRINT("CAutoHideDockContainer::collapseView " << Enable); diff --git a/src/DockAreaWidget.cpp b/src/DockAreaWidget.cpp index adaad98..a48883c 100644 --- a/src/DockAreaWidget.cpp +++ b/src/DockAreaWidget.cpp @@ -502,7 +502,6 @@ 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 2569539..9727062 100644 --- a/src/DockContainerWidget.cpp +++ b/src/DockContainerWidget.cpp @@ -846,7 +846,6 @@ void DockContainerWidgetPrivate::addDockAreasToList(const QList NewDockAreas) { - qDebug() << "DockContainerWidgetPrivate::appendDockAreas"; DockAreas.append(NewDockAreas); for (auto DockArea : NewDockAreas) { @@ -1326,13 +1325,11 @@ CDockContainerWidget::CDockContainerWidget(CDockManager* DockManager, QWidget *p { d->DockManager->registerDockContainer(this); createRootSplitter(); - if (CDockManager::testConfigFlag(CDockManager::AutoHideFeatureEnabled)) - { - createSideTabBarWidgets(); - } + createSideTabBarWidgets(); } } + //============================================================================ CDockContainerWidget::~CDockContainerWidget() { @@ -1566,7 +1563,6 @@ 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()) @@ -1779,7 +1775,6 @@ 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); @@ -1956,6 +1951,11 @@ void CDockContainerWidget::createRootSplitter() //============================================================================ void CDockContainerWidget::createSideTabBarWidgets() { + if (!CDockManager::testConfigFlag(CDockManager::AutoHideFeatureEnabled)) + { + return; + } + { auto Area = SideBarLocation::Left; d->SideTabBarWidgets[Area] = new CSideTabBar(this, Area); diff --git a/src/SideTabBar.cpp b/src/SideTabBar.cpp index 8ee67a3..7bd03c1 100644 --- a/src/SideTabBar.cpp +++ b/src/SideTabBar.cpp @@ -117,6 +117,7 @@ CSideTabBar::CSideTabBar(CDockContainerWidget* parent, SideBarLocation area) : CSideTabBar::~CSideTabBar() { qDebug() << "~CSideTabBar() "; + qDebug() << "parent " << d->ContainerWidget; // The SideTabeBar is not the owner of the tabs and to prevent deletion // we set the parent here to nullptr to remove it from the children auto Tabs = findChildren(QString(), Qt::FindDirectChildrenOnly); @@ -161,7 +162,6 @@ void CSideTabBar::removeDockWidget(CDockWidget* DockWidget) //============================================================================ void CSideTabBar::removeSideTab(CDockWidgetSideTab* SideTab) { - qDebug() << "CSideTabBar::removeSideTab " << SideTab->text(); SideTab->removeEventFilter(this); d->TabsLayout->removeWidget(SideTab); if (d->TabsLayout->isEmpty()) From 760c0365e0ed8fd289abb2a435f55b5dcca83238 Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Tue, 1 Nov 2022 11:35:07 +0100 Subject: [PATCH 17/22] Use explicit naming for functions to configure auto hide flags and disable auto hide feature by default --- demo/MainWindow.cpp | 4 ++-- examples/autohide/mainwindow.cpp | 2 +- src/DockManager.cpp | 6 +++--- src/DockManager.h | 12 +++++++++--- src/SideTabBar.cpp | 1 - 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/demo/MainWindow.cpp b/demo/MainWindow.cpp index ba5db06..f0bf1fe 100644 --- a/demo/MainWindow.cpp +++ b/demo/MainWindow.cpp @@ -654,7 +654,7 @@ CMainWindow::CMainWindow(QWidget *parent) : CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true); // uncomment if you would like to enable dock widget auto hiding - CDockManager::setConfigFlags(CDockManager::DefaultAutoHideConfig); + CDockManager::setAutoHideConfigFlags(CDockManager::DefaultAutoHideConfig); // uncomment if you would like to enable an equal distribution of the // available size of a splitter to all contained dock widgets @@ -749,7 +749,7 @@ void CMainWindow::onViewToggled(bool Open) return; } - //qDebug() << DockWidget->objectName() << " viewToggled(" << Open << ")"; + qDebug() << DockWidget->objectName() << " viewToggled(" << Open << ")"; } diff --git a/examples/autohide/mainwindow.cpp b/examples/autohide/mainwindow.cpp index 30061aa..4ae68be 100644 --- a/examples/autohide/mainwindow.cpp +++ b/examples/autohide/mainwindow.cpp @@ -27,7 +27,7 @@ CMainWindow::CMainWindow(QWidget *parent) CDockManager::setConfigFlag(CDockManager::OpaqueSplitterResize, true); CDockManager::setConfigFlag(CDockManager::XmlCompressionEnabled, false); CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true); - CDockManager::setConfigFlag(CDockManager::DefaultAutoHideConfig, true); + CDockManager::setAutoHideConfigFlags(CDockManager::DefaultAutoHideConfig); DockManager = new CDockManager(this); // Set central widget diff --git a/src/DockManager.cpp b/src/DockManager.cpp index 5899192..13cf731 100644 --- a/src/DockManager.cpp +++ b/src/DockManager.cpp @@ -93,7 +93,7 @@ enum eStateFileVersion }; static CDockManager::ConfigFlags StaticConfigFlags = CDockManager::DefaultNonOpaqueConfig; -static CDockManager::AutoHideFlags StaticAutoHideConfigFlags = CDockManager::DefaultAutoHideConfig; +static CDockManager::AutoHideFlags StaticAutoHideConfigFlags; // auto hide feature is disabled by default static QString FloatingContainersTitle; @@ -1159,7 +1159,7 @@ void CDockManager::setConfigFlags(const ConfigFlags Flags) //=========================================================================== -void CDockManager::setConfigFlags(const AutoHideFlags Flags) +void CDockManager::setAutoHideConfigFlags(const AutoHideFlags Flags) { StaticAutoHideConfigFlags = Flags; } @@ -1173,7 +1173,7 @@ void CDockManager::setConfigFlag(eConfigFlag Flag, bool On) //=========================================================================== -void CDockManager::setConfigFlag(eAutoHideFlag Flag, bool On) +void CDockManager::setAutoHideConfigFlag(eAutoHideFlag Flag, bool On) { internal::setFlag(StaticAutoHideConfigFlags, Flag, On); } diff --git a/src/DockManager.h b/src/DockManager.h index 74ba44a..9591945 100644 --- a/src/DockManager.h +++ b/src/DockManager.h @@ -226,9 +226,15 @@ public: }; Q_DECLARE_FLAGS(ConfigFlags, eConfigFlag) + + /** + * These global configuration flags configure some dock manager auto hide + * settings + * Set the dock manager flags, before you create the dock manager instance. + */ enum eAutoHideFlag { - AutoHideFeatureEnabled = 0x01, + AutoHideFeatureEnabled = 0x01, //!< enables / disables auto hide feature DockAreaHasAutoHideButton = 0x02, //!< If the flag is set each dock area has a auto hide menu button LeftSideBarIconOnly = 0x04, //!< If the flag is set left side bar will show only icon if a the dock widget has an icon assigned RightSideBarIconOnly = 0x08, //!< If the flag is set right side bar will show only icon if a the dock widget has an icon assigned @@ -279,7 +285,7 @@ public: * Call this function before you create the dock manager and before * your create the first dock widget. */ - static void setConfigFlags(const AutoHideFlags Flags); + static void setAutoHideConfigFlags(const AutoHideFlags Flags); /** * Set a certain config flag. @@ -291,7 +297,7 @@ public: * Set a certain overlay config flag. * \see setConfigFlags() */ - static void setConfigFlag(eAutoHideFlag Flag, bool On = true); + static void setAutoHideConfigFlag(eAutoHideFlag Flag, bool On = true); /** * Returns true if the given config flag is set diff --git a/src/SideTabBar.cpp b/src/SideTabBar.cpp index 7bd03c1..beb2d61 100644 --- a/src/SideTabBar.cpp +++ b/src/SideTabBar.cpp @@ -117,7 +117,6 @@ CSideTabBar::CSideTabBar(CDockContainerWidget* parent, SideBarLocation area) : CSideTabBar::~CSideTabBar() { qDebug() << "~CSideTabBar() "; - qDebug() << "parent " << d->ContainerWidget; // The SideTabeBar is not the owner of the tabs and to prevent deletion // we set the parent here to nullptr to remove it from the children auto Tabs = findChildren(QString(), Qt::FindDirectChildrenOnly); From 2370d79ca6d96c3eba5394c2cced6c4da220149a Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Tue, 1 Nov 2022 11:39:34 +0100 Subject: [PATCH 18/22] Removed debug code from DockManager saveState function --- src/DockManager.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/DockManager.cpp b/src/DockManager.cpp index 13cf731..5b4aefa 100644 --- a/src/DockManager.cpp +++ b/src/DockManager.cpp @@ -700,8 +700,7 @@ QByteArray CDockManager::saveState(int version) const QByteArray xmldata; QXmlStreamWriter s(&xmldata); auto ConfigFlags = CDockManager::configFlags(); - //s.setAutoFormatting(ConfigFlags.testFlag(XmlAutoFormattingEnabled)); - s.setAutoFormatting(true); + s.setAutoFormatting(ConfigFlags.testFlag(XmlAutoFormattingEnabled)); s.writeStartDocument(); s.writeStartElement("QtAdvancedDockingSystem"); s.writeAttribute("Version", QString::number(CurrentVersion)); @@ -719,8 +718,6 @@ QByteArray CDockManager::saveState(int version) const s.writeEndElement(); s.writeEndDocument(); - std::cout << xmldata.toStdString() << std::endl; - return ConfigFlags.testFlag(XmlCompressionEnabled) ? qCompress(xmldata, 9) : xmldata; } From 782af9a1fc01e5fda9561b9aff063374fc0d2ea4 Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Tue, 1 Nov 2022 12:06:59 +0100 Subject: [PATCH 19/22] Renamed SideTabBar and DockWidgetSideTab into AutoHideSideBar and AutoHideTab for consistent naming --- src/AutoHideDockContainer.cpp | 14 ++--- src/AutoHideDockContainer.h | 11 ++-- src/{SideTabBar.cpp => AutoHideSideBar.cpp} | 55 +++++++++---------- src/{SideTabBar.h => AutoHideSideBar.h} | 32 +++++------ ...{DockWidgetSideTab.cpp => AutoHideTab.cpp} | 53 +++++++++--------- src/{DockWidgetSideTab.h => AutoHideTab.h} | 20 +++---- src/DockAreaWidget.cpp | 2 +- src/DockAreaWidget.h | 2 +- src/DockComponentsFactory.cpp | 6 +- src/DockComponentsFactory.h | 4 +- src/DockContainerWidget.cpp | 16 +++--- src/DockContainerWidget.h | 6 +- src/DockFocusController.cpp | 2 +- src/DockManager.h | 4 +- src/DockWidget.cpp | 10 ++-- src/DockWidget.h | 10 ++-- src/src.pro | 8 +-- src/stylesheets/default.css | 40 +++++++------- src/stylesheets/default_linux.css | 40 +++++++------- src/stylesheets/focus_highlighting.css | 42 +++++++------- src/stylesheets/focus_highlighting_linux.css | 40 +++++++------- src/stylesheets/visual_studio_light.css | 28 +++++----- 22 files changed, 221 insertions(+), 224 deletions(-) rename src/{SideTabBar.cpp => AutoHideSideBar.cpp} (82%) rename src/{SideTabBar.h => AutoHideSideBar.h} (83%) rename src/{DockWidgetSideTab.cpp => AutoHideTab.cpp} (78%) rename src/{DockWidgetSideTab.h => AutoHideTab.h} (89%) diff --git a/src/AutoHideDockContainer.cpp b/src/AutoHideDockContainer.cpp index 08370a3..14d3c8a 100644 --- a/src/AutoHideDockContainer.cpp +++ b/src/AutoHideDockContainer.cpp @@ -27,6 +27,8 @@ //============================================================================ // INCLUDES //============================================================================ +#include +#include #include "AutoHideDockContainer.h" #include @@ -37,9 +39,7 @@ #include #include "DockManager.h" -#include "DockWidgetSideTab.h" #include "DockWidgetTab.h" -#include "SideTabBar.h" #include "DockAreaWidget.h" #include "DockingStateReader.h" #include "ResizeHandle.h" @@ -110,7 +110,7 @@ struct AutoHideDockContainerPrivate QBoxLayout* Layout; CResizeHandle* ResizeHandle = nullptr; QSize Size; // creates invalid size - QPointer SideTab; + QPointer SideTab; /** * Private data constructor @@ -186,7 +186,7 @@ CAutoHideDockContainer::CAutoHideDockContainer(CDockManager* DockManager, SideBa hide(); // auto hide dock container is initially always hidden d->SideTabBarArea = area; d->SideTab = componentsFactory()->createDockWidgetSideTab(nullptr); - connect(d->SideTab, &CDockWidgetSideTab::pressed, this, &CAutoHideDockContainer::toggleCollapseState); + connect(d->SideTab, &CAutoHideTab::pressed, this, &CAutoHideDockContainer::toggleCollapseState); d->DockArea = new CDockAreaWidget(DockManager, parent); d->DockArea->setObjectName("autoHideDockArea"); d->DockArea->setAutoHideDockContainer(this); @@ -275,14 +275,14 @@ CAutoHideDockContainer::~CAutoHideDockContainer() } //============================================================================ -CSideTabBar* CAutoHideDockContainer::sideTabBar() const +CAutoHideSideBar* CAutoHideDockContainer::sideTabBar() const { return parentContainer()->sideTabBar(d->SideTabBarArea); } //============================================================================ -CDockWidgetSideTab* CAutoHideDockContainer::sideTab() const +CAutoHideTab* CAutoHideDockContainer::sideTab() const { return d->SideTab; } @@ -357,7 +357,7 @@ void CAutoHideDockContainer::cleanupAndDelete() if (dockWidget) { auto SideTab = d->SideTab; - SideTab->removeFromSideTabBar(); + SideTab->removeFromSideBar(); SideTab->setParent(dockWidget); SideTab->hide(); } diff --git a/src/AutoHideDockContainer.h b/src/AutoHideDockContainer.h index eb93cf2..4943cd6 100644 --- a/src/AutoHideDockContainer.h +++ b/src/AutoHideDockContainer.h @@ -31,9 +31,8 @@ //============================================================================ #include "ads_globals.h" -#include "DockWidgetSideTab.h" - #include +#include "AutoHideTab.h" class QXmlStreamWriter; @@ -43,7 +42,7 @@ struct AutoHideDockContainerPrivate; class CDockManager; class CDockWidget; class CDockContainerWidget; -class CSideTabBar; +class CAutoHideSideBar; class CDockAreaWidget; class CDockingStateReader; struct SideTabBarPrivate; @@ -58,7 +57,7 @@ class ADS_EXPORT CAutoHideDockContainer : public QFrame private: AutoHideDockContainerPrivate* d; ///< private data (pimpl) friend struct AutoHideDockContainerPrivate; - friend CSideTabBar; + friend CAutoHideSideBar; friend SideTabBarPrivate; protected: @@ -93,12 +92,12 @@ public: /** * Get's the side tab bar */ - CSideTabBar* sideTabBar() const; + CAutoHideSideBar* sideTabBar() const; /** * Returns the side tab */ - CDockWidgetSideTab* sideTab() const; + CAutoHideTab* sideTab() const; /** * Get's the dock widget in this dock container diff --git a/src/SideTabBar.cpp b/src/AutoHideSideBar.cpp similarity index 82% rename from src/SideTabBar.cpp rename to src/AutoHideSideBar.cpp index beb2d61..7b0a5c0 100644 --- a/src/SideTabBar.cpp +++ b/src/AutoHideSideBar.cpp @@ -29,15 +29,14 @@ //============================================================================ // INCLUDES //============================================================================ -#include "SideTabBar.h" - +#include +#include #include #include #include #include #include "DockContainerWidget.h" -#include "DockWidgetSideTab.h" #include "DockWidgetTab.h" #include "DockFocusController.h" #include "AutoHideDockContainer.h" @@ -49,14 +48,14 @@ namespace ads /** * Private data class of CSideTabBar class (pimpl) */ -struct SideTabBarPrivate +struct AutoHideSideBarPrivate { /** * Private data constructor */ - SideTabBarPrivate(CSideTabBar* _public); + AutoHideSideBarPrivate(CAutoHideSideBar* _public); - CSideTabBar* _this; + CAutoHideSideBar* _this; CDockContainerWidget* ContainerWidget; QBoxLayout* TabsLayout; Qt::Orientation Orientation; @@ -69,19 +68,19 @@ struct SideTabBarPrivate { return Qt::Horizontal == Orientation; } -}; // struct SideTabBarPrivate +}; // struct AutoHideSideBarPrivate //============================================================================ -SideTabBarPrivate::SideTabBarPrivate(CSideTabBar* _public) : +AutoHideSideBarPrivate::AutoHideSideBarPrivate(CAutoHideSideBar* _public) : _this(_public) { } //============================================================================ -CSideTabBar::CSideTabBar(CDockContainerWidget* parent, SideBarLocation area) : +CAutoHideSideBar::CAutoHideSideBar(CDockContainerWidget* parent, SideBarLocation area) : Super(parent), - d(new SideTabBarPrivate(this)) + d(new AutoHideSideBarPrivate(this)) { d->SideTabArea = area; d->ContainerWidget = parent; @@ -114,12 +113,12 @@ CSideTabBar::CSideTabBar(CDockContainerWidget* parent, SideBarLocation area) : //============================================================================ -CSideTabBar::~CSideTabBar() +CAutoHideSideBar::~CAutoHideSideBar() { qDebug() << "~CSideTabBar() "; // The SideTabeBar is not the owner of the tabs and to prevent deletion // we set the parent here to nullptr to remove it from the children - auto Tabs = findChildren(QString(), Qt::FindDirectChildrenOnly); + auto Tabs = findChildren(QString(), Qt::FindDirectChildrenOnly); for (auto Tab : Tabs) { Tab->setParent(nullptr); @@ -129,10 +128,10 @@ CSideTabBar::~CSideTabBar() //============================================================================ -void CSideTabBar::insertSideTab(int Index, CDockWidgetSideTab* SideTab) +void CAutoHideSideBar::insertSideTab(int Index, CAutoHideTab* SideTab) { SideTab->installEventFilter(this); - SideTab->setSideTabBar(this); + SideTab->setSideBar(this); SideTab->updateOrientationForArea(d->SideTabArea); d->TabsLayout->insertWidget(Index, SideTab); show(); @@ -140,7 +139,7 @@ void CSideTabBar::insertSideTab(int Index, CDockWidgetSideTab* SideTab) //============================================================================ -CAutoHideDockContainer* CSideTabBar::insertDockWidget(int Index, CDockWidget* DockWidget) +CAutoHideDockContainer* CAutoHideSideBar::insertDockWidget(int Index, CDockWidget* DockWidget) { auto AutoHideContainer = new CAutoHideDockContainer(DockWidget, d->SideTabArea, d->ContainerWidget); DockWidget->dockManager()->dockFocusController()->clearDockWidgetFocus(DockWidget); @@ -151,7 +150,7 @@ CAutoHideDockContainer* CSideTabBar::insertDockWidget(int Index, CDockWidget* Do //============================================================================ -void CSideTabBar::removeDockWidget(CDockWidget* DockWidget) +void CAutoHideSideBar::removeDockWidget(CDockWidget* DockWidget) { Q_UNUSED(DockWidget); // TODO implement @@ -159,7 +158,7 @@ void CSideTabBar::removeDockWidget(CDockWidget* DockWidget) //============================================================================ -void CSideTabBar::removeSideTab(CDockWidgetSideTab* SideTab) +void CAutoHideSideBar::removeSideTab(CAutoHideTab* SideTab) { SideTab->removeEventFilter(this); d->TabsLayout->removeWidget(SideTab); @@ -171,7 +170,7 @@ void CSideTabBar::removeSideTab(CDockWidgetSideTab* SideTab) //============================================================================ -bool CSideTabBar::event(QEvent* e) +bool CAutoHideSideBar::event(QEvent* e) { switch (e->type()) { @@ -211,7 +210,7 @@ bool CSideTabBar::event(QEvent* e) //============================================================================ -bool CSideTabBar::eventFilter(QObject *watched, QEvent *event) +bool CAutoHideSideBar::eventFilter(QObject *watched, QEvent *event) { if (event->type() != QEvent::ShowToParent) { @@ -219,7 +218,7 @@ bool CSideTabBar::eventFilter(QObject *watched, QEvent *event) } // As soon as on tab is shhown, we need to show the side tab bar - auto Tab = qobject_cast(watched); + auto Tab = qobject_cast(watched); if (Tab) { show(); @@ -229,7 +228,7 @@ bool CSideTabBar::eventFilter(QObject *watched, QEvent *event) //============================================================================ -void CSideTabBar::paintEvent(QPaintEvent* event) +void CAutoHideSideBar::paintEvent(QPaintEvent* event) { Q_UNUSED(event) @@ -241,35 +240,35 @@ void CSideTabBar::paintEvent(QPaintEvent* event) //============================================================================ -Qt::Orientation CSideTabBar::orientation() const +Qt::Orientation CAutoHideSideBar::orientation() const { return d->Orientation; } //============================================================================ -CDockWidgetSideTab* CSideTabBar::tabAt(int index) const +CAutoHideTab* CAutoHideSideBar::tabAt(int index) const { - return qobject_cast(d->TabsLayout->itemAt(index)->widget()); + return qobject_cast(d->TabsLayout->itemAt(index)->widget()); } //============================================================================ -int CSideTabBar::tabCount() const +int CAutoHideSideBar::tabCount() const { return d->TabsLayout->count(); } //============================================================================ -SideBarLocation CSideTabBar::sideTabBarArea() const +SideBarLocation CAutoHideSideBar::sideBarArea() const { return d->SideTabArea; } //============================================================================ -void CSideTabBar::saveState(QXmlStreamWriter& s) const +void CAutoHideSideBar::saveState(QXmlStreamWriter& s) const { if (!tabCount()) { @@ -277,7 +276,7 @@ void CSideTabBar::saveState(QXmlStreamWriter& s) const } s.writeStartElement("SideBar"); - s.writeAttribute("Area", QString::number(sideTabBarArea())); + s.writeAttribute("Area", QString::number(sideBarArea())); s.writeAttribute("Tabs", QString::number(tabCount())); for (auto i = 0; i < tabCount(); ++i) diff --git a/src/SideTabBar.h b/src/AutoHideSideBar.h similarity index 83% rename from src/SideTabBar.h rename to src/AutoHideSideBar.h index f11e3e3..c27820c 100644 --- a/src/SideTabBar.h +++ b/src/AutoHideSideBar.h @@ -1,5 +1,5 @@ -#ifndef SideTabBarH -#define SideTabBarH +#ifndef AutoHideSideBarH +#define AutoHideSideBarH /******************************************************************************* ** Qt Advanced Docking System ** Copyright (C) 2017 Uwe Kindler @@ -23,24 +23,24 @@ /// \file DockWidgetTab.h /// \author Syarif Fakhri /// \date 05.09.2022 -/// \brief Declaration of CSideTabBar class +/// \brief Declaration of CAutoHideSideBar class //============================================================================ //============================================================================ // INCLUDES //============================================================================ #include -#include "DockWidgetSideTab.h" #include "ads_globals.h" +#include "AutoHideTab.h" class QXmlStreamWriter; namespace ads { -struct SideTabBarPrivate; +struct AutoHideSideBarPrivate; class DockContainerWidgetPrivate; class CDockContainerWidget; -class CDockWidgetSideTab; +class CAutoHideTab; class CAutoHideDockContainer; class CDockingStateReader; @@ -51,15 +51,15 @@ class CDockingStateReader; * side bar is also hidden. As soon as one single tab becomes visible, this * tab bar will be shown. */ -class ADS_EXPORT CSideTabBar : public QFrame +class ADS_EXPORT CAutoHideSideBar : public QFrame { Q_OBJECT - Q_PROPERTY(int sideTabBarArea READ sideTabBarArea) + Q_PROPERTY(int sideBarArea READ sideBarArea) Q_PROPERTY(Qt::Orientation orientation READ orientation) private: - SideTabBarPrivate* d; ///< private data (pimpl) - friend struct SideTabBarPrivate; + AutoHideSideBarPrivate* d; ///< private data (pimpl) + friend struct AutoHideSideBarPrivate; friend class DockWidgetSideTab; friend DockContainerWidgetPrivate; @@ -79,22 +79,22 @@ public: /** * Default Constructor */ - CSideTabBar(CDockContainerWidget* parent, SideBarLocation area); + CAutoHideSideBar(CDockContainerWidget* parent, SideBarLocation area); /** * Virtual Destructor */ - virtual ~CSideTabBar(); + virtual ~CAutoHideSideBar(); /** * Inserts the given dock widget tab at the given position. */ - void insertSideTab(int Index, CDockWidgetSideTab* SideTab); + void insertSideTab(int Index, CAutoHideTab* SideTab); /** * Removes the given DockWidgetSideTab from the tabbar */ - void removeSideTab(CDockWidgetSideTab* SideTab); + void removeSideTab(CAutoHideTab* SideTab); /** * Insert dock widget @@ -114,7 +114,7 @@ public: /* * get the side tab widget at position, returns nullptr if it's out of bounds */ - CDockWidgetSideTab* tabAt(int index) const; + CAutoHideTab* tabAt(int index) const; /* * Gets the count of the tab widgets @@ -124,7 +124,7 @@ public: /** * Getter for side tab bar area property */ - SideBarLocation sideTabBarArea() const; + SideBarLocation sideBarArea() const; Q_SIGNALS: void sideTabAutoHideToggleRequested(); diff --git a/src/DockWidgetSideTab.cpp b/src/AutoHideTab.cpp similarity index 78% rename from src/DockWidgetSideTab.cpp rename to src/AutoHideTab.cpp index c7c1b1a..8667657 100644 --- a/src/DockWidgetSideTab.cpp +++ b/src/AutoHideTab.cpp @@ -28,9 +28,8 @@ // INCLUDES //============================================================================ #include -#include "DockWidgetSideTab.h" -#include "SideTabBar.h" - +#include +#include #include #include "DockAreaWidget.h" @@ -43,22 +42,22 @@ namespace ads /** * Private data class of CDockWidgetTab class (pimpl) */ -struct DockWidgetSideTabPrivate +struct AutoHideTabPrivate { - CDockWidgetSideTab* _this; + CAutoHideTab* _this; CDockWidget* DockWidget = nullptr; - CSideTabBar* SideTabBar = nullptr; + CAutoHideSideBar* SideBar = nullptr; Qt::Orientation Orientation{Qt::Vertical}; /** * Private data constructor */ - DockWidgetSideTabPrivate(CDockWidgetSideTab* _public); + AutoHideTabPrivate(CAutoHideTab* _public); }; // struct DockWidgetTabPrivate //============================================================================ -DockWidgetSideTabPrivate::DockWidgetSideTabPrivate(CDockWidgetSideTab* _public) : +AutoHideTabPrivate::AutoHideTabPrivate(CAutoHideTab* _public) : _this(_public) { @@ -66,27 +65,27 @@ DockWidgetSideTabPrivate::DockWidgetSideTabPrivate(CDockWidgetSideTab* _public) //============================================================================ -void CDockWidgetSideTab::setSideTabBar(CSideTabBar* SideTabBar) +void CAutoHideTab::setSideBar(CAutoHideSideBar* SideTabBar) { - d->SideTabBar = SideTabBar; + d->SideBar = SideTabBar; } //============================================================================ -void CDockWidgetSideTab::removeFromSideTabBar() +void CAutoHideTab::removeFromSideBar() { - if (d->SideTabBar == nullptr) + if (d->SideBar == nullptr) { return; } - d->SideTabBar->removeSideTab(this); - setSideTabBar(nullptr); + d->SideBar->removeSideTab(this); + setSideBar(nullptr); } //============================================================================ -CDockWidgetSideTab::CDockWidgetSideTab(QWidget* parent) : +CAutoHideTab::CAutoHideTab(QWidget* parent) : Super(parent), - d(new DockWidgetSideTabPrivate(this)) + d(new AutoHideTabPrivate(this)) { setAttribute(Qt::WA_NoMousePropagation); setFocusPolicy(Qt::NoFocus); @@ -94,7 +93,7 @@ CDockWidgetSideTab::CDockWidgetSideTab(QWidget* parent) : //============================================================================ -CDockWidgetSideTab::~CDockWidgetSideTab() +CAutoHideTab::~CAutoHideTab() { qDebug() << "~CDockWidgetSideTab()"; delete d; @@ -102,7 +101,7 @@ CDockWidgetSideTab::~CDockWidgetSideTab() //============================================================================ -void CDockWidgetSideTab::updateStyle() +void CAutoHideTab::updateStyle() { internal::repolishStyle(this, internal::RepolishDirectChildren); update(); @@ -110,11 +109,11 @@ void CDockWidgetSideTab::updateStyle() //============================================================================ -SideBarLocation CDockWidgetSideTab::sideTabBarArea() const +SideBarLocation CAutoHideTab::sideTabBarArea() const { - if (d->SideTabBar) + if (d->SideBar) { - return d->SideTabBar->sideTabBarArea(); + return d->SideBar->sideBarArea(); } return Left; @@ -122,7 +121,7 @@ SideBarLocation CDockWidgetSideTab::sideTabBarArea() const //============================================================================ -void CDockWidgetSideTab::setOrientation(Qt::Orientation Orientation) +void CAutoHideTab::setOrientation(Qt::Orientation Orientation) { d->Orientation = Orientation; CPushButton::setButtonOrientation((Qt::Horizontal == Orientation) @@ -132,14 +131,14 @@ void CDockWidgetSideTab::setOrientation(Qt::Orientation Orientation) //============================================================================ -Qt::Orientation CDockWidgetSideTab::orientation() const +Qt::Orientation CAutoHideTab::orientation() const { return d->Orientation; } //============================================================================ -void CDockWidgetSideTab::updateOrientationForArea(SideBarLocation area) +void CAutoHideTab::updateOrientationForArea(SideBarLocation area) { setOrientation((area == Bottom || area == Top) ? Qt::Horizontal : Qt::Vertical); @@ -177,7 +176,7 @@ void CDockWidgetSideTab::updateOrientationForArea(SideBarLocation area) //============================================================================ -bool CDockWidgetSideTab::isActiveTab() const +bool CAutoHideTab::isActiveTab() const { if (d->DockWidget && d->DockWidget->autoHideDockContainer()) { @@ -189,14 +188,14 @@ bool CDockWidgetSideTab::isActiveTab() const //============================================================================ -CDockWidget* CDockWidgetSideTab::dockWidget() const +CDockWidget* CAutoHideTab::dockWidget() const { return d->DockWidget; } //============================================================================ -void CDockWidgetSideTab::setDockWidget(CDockWidget* DockWidget) +void CAutoHideTab::setDockWidget(CDockWidget* DockWidget) { if (!DockWidget) { diff --git a/src/DockWidgetSideTab.h b/src/AutoHideTab.h similarity index 89% rename from src/DockWidgetSideTab.h rename to src/AutoHideTab.h index 04bdacd..d616415 100644 --- a/src/DockWidgetSideTab.h +++ b/src/AutoHideTab.h @@ -35,9 +35,9 @@ namespace ads { -struct DockWidgetSideTabPrivate; +struct AutoHideTabPrivate; class CDockWidget; -class CSideTabBar; +class CAutoHideSideBar; class CDockWidgetTab; struct SideTabIconLabelPrivate; @@ -46,7 +46,7 @@ struct SideTabIconLabelPrivate; * The dock widget tab is shown in the side tab bar to switch between * pinned dock widgets */ -class ADS_EXPORT CDockWidgetSideTab : public CPushButton +class ADS_EXPORT CAutoHideTab : public CPushButton { Q_OBJECT @@ -55,18 +55,18 @@ class ADS_EXPORT CDockWidgetSideTab : public CPushButton Q_PROPERTY(bool activeTab READ isActiveTab) private: - DockWidgetSideTabPrivate* d; ///< private data (pimpl) - friend struct DockWidgetSideTabPrivate; + AutoHideTabPrivate* d; ///< private data (pimpl) + friend struct AutoHideTabPrivate; friend class CDockWidget; friend class CAutoHideDockContainer; protected: - friend class CSideTabBar; + friend class CAutoHideSideBar; friend class CDockAreaWidget; friend class CDockContainerWidget; - void setSideTabBar(CSideTabBar *SideTabBar); - void removeFromSideTabBar(); + void setSideBar(CAutoHideSideBar *SideTabBar); + void removeFromSideBar(); public: using Super = CPushButton; @@ -76,12 +76,12 @@ public: * param[in] DockWidget The dock widget this title bar belongs to * param[in] parent The parent widget of this title bar */ - CDockWidgetSideTab(QWidget* parent = nullptr); + CAutoHideTab(QWidget* parent = nullptr); /** * Virtual Destructor */ - virtual ~CDockWidgetSideTab(); + virtual ~CAutoHideTab(); /** * Update stylesheet style if a property changes diff --git a/src/DockAreaWidget.cpp b/src/DockAreaWidget.cpp index a48883c..c6d5523 100644 --- a/src/DockAreaWidget.cpp +++ b/src/DockAreaWidget.cpp @@ -29,6 +29,7 @@ // INCLUDES //============================================================================ #include +#include #include "DockAreaWidget.h" #include @@ -52,7 +53,6 @@ #include "DockAreaTitleBar.h" #include "DockComponentsFactory.h" #include "DockWidgetTab.h" -#include "DockWidgetSideTab.h" #include "DockingStateReader.h" diff --git a/src/DockAreaWidget.h b/src/DockAreaWidget.h index edb1b02..4059a83 100644 --- a/src/DockAreaWidget.h +++ b/src/DockAreaWidget.h @@ -33,8 +33,8 @@ #include #include "ads_globals.h" +#include "AutoHideTab.h" #include "DockWidget.h" -#include "DockWidgetSideTab.h" QT_FORWARD_DECLARE_CLASS(QXmlStreamWriter) QT_FORWARD_DECLARE_CLASS(QAbstractButton) diff --git a/src/DockComponentsFactory.cpp b/src/DockComponentsFactory.cpp index 3e7ebc1..05259d7 100644 --- a/src/DockComponentsFactory.cpp +++ b/src/DockComponentsFactory.cpp @@ -8,6 +8,7 @@ //============================================================================ // INCLUDES //============================================================================ +#include #include "DockComponentsFactory.h" #include @@ -17,7 +18,6 @@ #include "DockAreaTitleBar.h" #include "DockWidget.h" #include "DockAreaWidget.h" -#include "DockWidgetSideTab.h" namespace ads { @@ -31,9 +31,9 @@ CDockWidgetTab* CDockComponentsFactory::createDockWidgetTab(CDockWidget* DockWid } //============================================================================ -CDockWidgetSideTab* CDockComponentsFactory::createDockWidgetSideTab(CDockWidget *DockWidget) const +CAutoHideTab* CDockComponentsFactory::createDockWidgetSideTab(CDockWidget *DockWidget) const { - return new CDockWidgetSideTab(DockWidget); + return new CAutoHideTab(DockWidget); } diff --git a/src/DockComponentsFactory.h b/src/DockComponentsFactory.h index 3e726ae..0d2b7d4 100644 --- a/src/DockComponentsFactory.h +++ b/src/DockComponentsFactory.h @@ -19,7 +19,7 @@ class CDockAreaTitleBar; class CDockAreaTabBar; class CDockAreaWidget; class CDockWidget; -class CDockWidgetSideTab; +class CAutoHideTab; @@ -51,7 +51,7 @@ public: * This default implementation just creates a dock widget side tab with * new CDockWidgetTab(DockWidget). */ - virtual CDockWidgetSideTab* createDockWidgetSideTab(CDockWidget* DockWidget) const; + virtual CAutoHideTab* createDockWidgetSideTab(CDockWidget* DockWidget) const; /** * This default implementation just creates a dock area tab bar with diff --git a/src/DockContainerWidget.cpp b/src/DockContainerWidget.cpp index 9727062..4a6ef86 100644 --- a/src/DockContainerWidget.cpp +++ b/src/DockContainerWidget.cpp @@ -29,6 +29,8 @@ // INCLUDES //============================================================================ #include +#include +#include #include "DockContainerWidget.h" #include @@ -49,9 +51,7 @@ #include "DockOverlay.h" #include "ads_globals.h" #include "DockSplitter.h" -#include "SideTabBar.h" #include "DockWidgetTab.h" -#include "DockWidgetSideTab.h" #include "DockAreaTitleBar.h" #include "DockFocusController.h" @@ -139,7 +139,7 @@ public: unsigned int zOrderIndex = 0; QList DockAreas; QList AutoHideWidgets; - QMap SideTabBarWidgets; + QMap SideTabBarWidgets; QGridLayout* Layout = nullptr; QSplitter* RootSplitter = nullptr; bool isFloating = false; @@ -1958,25 +1958,25 @@ void CDockContainerWidget::createSideTabBarWidgets() { auto Area = SideBarLocation::Left; - d->SideTabBarWidgets[Area] = new CSideTabBar(this, Area); + d->SideTabBarWidgets[Area] = new CAutoHideSideBar(this, Area); d->Layout->addWidget(d->SideTabBarWidgets[Area], 1, 0); } { auto Area = SideBarLocation::Right; - d->SideTabBarWidgets[Area] = new CSideTabBar(this, Area); + d->SideTabBarWidgets[Area] = new CAutoHideSideBar(this, Area); d->Layout->addWidget(d->SideTabBarWidgets[Area], 1, 2); } { auto Area = SideBarLocation::Bottom; - d->SideTabBarWidgets[Area] = new CSideTabBar(this, Area); + d->SideTabBarWidgets[Area] = new CAutoHideSideBar(this, Area); d->Layout->addWidget(d->SideTabBarWidgets[Area], 2, 1); } { auto Area = SideBarLocation::Top; - d->SideTabBarWidgets[Area] = new CSideTabBar(this, Area); + d->SideTabBarWidgets[Area] = new CAutoHideSideBar(this, Area); d->Layout->addWidget(d->SideTabBarWidgets[Area], 0, 1); } } @@ -2126,7 +2126,7 @@ void CDockContainerWidget::closeOtherAreas(CDockAreaWidget* KeepOpenArea) } //============================================================================ -CSideTabBar* CDockContainerWidget::sideTabBar(SideBarLocation area) const +CAutoHideSideBar* CDockContainerWidget::sideTabBar(SideBarLocation area) const { return d->SideTabBarWidgets[area]; } diff --git a/src/DockContainerWidget.h b/src/DockContainerWidget.h index b97783a..e8737e8 100644 --- a/src/DockContainerWidget.h +++ b/src/DockContainerWidget.h @@ -33,8 +33,8 @@ #include #include "ads_globals.h" +#include "AutoHideTab.h" #include "DockWidget.h" -#include "DockWidgetSideTab.h" QT_FORWARD_DECLARE_CLASS(QXmlStreamWriter) @@ -51,7 +51,7 @@ struct FloatingDockContainerPrivate; class CFloatingDragPreview; struct FloatingDragPreviewPrivate; class CDockingStateReader; -class CSideTabBar; +class CAutoHideSideBar; /** @@ -321,7 +321,7 @@ public: /** * Returns the side tab widget for the given area */ - CSideTabBar* sideTabBar(SideBarLocation area) const; + CAutoHideSideBar* sideTabBar(SideBarLocation area) const; /** diff --git a/src/DockFocusController.cpp b/src/DockFocusController.cpp index 3056c07..322ff29 100644 --- a/src/DockFocusController.cpp +++ b/src/DockFocusController.cpp @@ -8,6 +8,7 @@ //============================================================================ // INCLUDES //============================================================================ +#include #include "DockFocusController.h" #include @@ -25,7 +26,6 @@ #include "FloatingDockContainer.h" #include "DockManager.h" #include "DockAreaTitleBar.h" -#include "DockWidgetSideTab.h" #ifdef Q_OS_LINUX #include "linux/FloatingWidgetTitleBar.h" diff --git a/src/DockManager.h b/src/DockManager.h index 9591945..810ebbf 100644 --- a/src/DockManager.h +++ b/src/DockManager.h @@ -54,7 +54,7 @@ struct DockAreaWidgetPrivate; class CIconProvider; class CDockComponentsFactory; class CDockFocusController; -class CSideTabBar; +class CAutoHideSideBar; /** * The central dock manager that maintains the complete docking system. @@ -86,7 +86,7 @@ private: friend struct FloatingDragPreviewPrivate; friend class CDockAreaTitleBar; friend class CAutoHideDockContainer; - friend CSideTabBar; + friend CAutoHideSideBar; protected: diff --git a/src/DockWidget.cpp b/src/DockWidget.cpp index 529bd1a..be44c37 100644 --- a/src/DockWidget.cpp +++ b/src/DockWidget.cpp @@ -29,6 +29,8 @@ // INCLUDES //============================================================================ #include +#include +#include #include "DockWidgetTab.h" #include "DockWidget.h" @@ -51,8 +53,6 @@ #include #include -#include "SideTabBar.h" -#include "DockWidgetSideTab.h" #include "DockContainerWidget.h" #include "DockAreaWidget.h" #include "DockManager.h" @@ -95,7 +95,7 @@ struct DockWidgetPrivate CDockWidget::eMinimumSizeHintMode MinimumSizeHintMode = CDockWidget::MinimumSizeHintFromDockWidget; WidgetFactory* Factory = nullptr; CDockWidget::eAutoHideInsertOrder AutoHideInsertOrder = CDockWidget::Last; - QPointer SideTabWidget; + QPointer SideTabWidget; /** * Private data constructor @@ -522,14 +522,14 @@ CDockAreaWidget* CDockWidget::dockAreaWidget() const } //============================================================================ -CDockWidgetSideTab* CDockWidget::sideTabWidget() const +CAutoHideTab* CDockWidget::sideTabWidget() const { return d->SideTabWidget; } //============================================================================ -void CDockWidget::setSideTabWidget(CDockWidgetSideTab* SideTab) const +void CDockWidget::setSideTabWidget(CAutoHideTab* SideTab) const { d->SideTabWidget = SideTab; } diff --git a/src/DockWidget.h b/src/DockWidget.h index d8048a2..76f2dce 100644 --- a/src/DockWidget.h +++ b/src/DockWidget.h @@ -46,9 +46,9 @@ class CDockContainerWidget; class CDockAreaWidget; class DockContainerWidgetPrivate; class CFloatingDockContainer; -class CDockWidgetSideTab; +class CAutoHideTab; class CAutoHideDockContainer; -class CSideTabBar; +class CAutoHideSideBar; /** * The QDockWidget class provides a widget that can be docked inside a @@ -79,7 +79,7 @@ protected: friend struct DockWidgetTabPrivate; friend struct DockAreaTitleBarPrivate; friend class CAutoHideDockContainer; - friend CSideTabBar; + friend CAutoHideSideBar; /** * Assigns the dock manager that manages this dock widget @@ -365,12 +365,12 @@ public: * a auto hide container. If it is not in a auto hide container, then this * function returns a nullptr, */ - CDockWidgetSideTab* sideTabWidget() const; + CAutoHideTab* sideTabWidget() const; /** * Assign a side tab widget if this dock widget is an auto hide container */ - void setSideTabWidget(CDockWidgetSideTab* SideTab) const; + void setSideTabWidget(CAutoHideTab* SideTab) const; /** * Returns true, if this dock widget is in an auto hide container diff --git a/src/src.pro b/src/src.pro index 101f7a3..79344b1 100644 --- a/src/src.pro +++ b/src/src.pro @@ -49,8 +49,8 @@ HEADERS += \ DockComponentsFactory.h \ DockFocusController.h \ AutoHideDockContainer.h \ - SideTabBar.h \ - DockWidgetSideTab.h \ + AutoHideSideBar.h \ + AutoHideTab.h \ PushButton.h \ ResizeHandle.h @@ -74,8 +74,8 @@ SOURCES += \ DockComponentsFactory.cpp \ DockFocusController.cpp \ AutoHideDockContainer.cpp \ - SideTabBar.cpp \ - DockWidgetSideTab.cpp \ + AutoHideSideBar.cpp \ + AutoHideTab.cpp \ PushButton.cpp \ ResizeHandle.cpp diff --git a/src/stylesheets/default.css b/src/stylesheets/default.css index b72c50b..c7e067b 100644 --- a/src/stylesheets/default.css +++ b/src/stylesheets/default.css @@ -128,9 +128,9 @@ QScrollArea#dockWidgetScrollArea { /***************************************************************************** - * CDockWidgetSideTab + * CAutoHideTab *****************************************************************************/ -ads--CDockWidgetSideTab { +ads--CAutoHideTab { qproperty-iconSize: 16px 16px;/* this is optional in case you would like to change icon size*/ background: none; border: none; @@ -142,66 +142,66 @@ ads--CDockWidgetSideTab { } -ads--CDockWidgetSideTab[sideTabBarArea="0"], -ads--CDockWidgetSideTab[sideTabBarArea="2"] { +ads--CAutoHideTab[sideTabBarArea="0"], +ads--CAutoHideTab[sideTabBarArea="2"] { border-top: 5px solid rgba(0, 0, 0, 48); } -ads--CDockWidgetSideTab[sideTabBarArea="1"], -ads--CDockWidgetSideTab[sideTabBarArea="3"] { +ads--CAutoHideTab[sideTabBarArea="1"], +ads--CAutoHideTab[sideTabBarArea="3"] { border-bottom: 5px solid rgba(0, 0, 0, 48); } -ads--CDockWidgetSideTab:hover[sideTabBarArea="0"], -ads--CDockWidgetSideTab:hover[sideTabBarArea="2"] { +ads--CAutoHideTab:hover[sideTabBarArea="0"], +ads--CAutoHideTab:hover[sideTabBarArea="2"] { border-top: 5px solid palette(highlight); color: palette(highlight); } -ads--CDockWidgetSideTab:hover[sideTabBarArea="1"], -ads--CDockWidgetSideTab:hover[sideTabBarArea="3"] { +ads--CAutoHideTab:hover[sideTabBarArea="1"], +ads--CAutoHideTab:hover[sideTabBarArea="3"] { border-bottom: 5px solid palette(highlight); color: palette(highlight); } -ads--CDockWidgetSideTab[sideTabBarArea="0"][activeTab="true"], -ads--CDockWidgetSideTab[sideTabBarArea="2"][activeTab="true"] { +ads--CAutoHideTab[sideTabBarArea="0"][activeTab="true"], +ads--CAutoHideTab[sideTabBarArea="2"][activeTab="true"] { border-top: 5px solid palette(highlight); } -ads--CDockWidgetSideTab[sideTabBarArea="1"][activeTab="true"], -ads--CDockWidgetSideTab[sideTabBarArea="3"][activeTab="true"] { +ads--CAutoHideTab[sideTabBarArea="1"][activeTab="true"], +ads--CAutoHideTab[sideTabBarArea="3"][activeTab="true"] { border-bottom: 5px solid palette(highlight); } /***************************************************************************** - * CSideTabBar + * CAutoHideBar *****************************************************************************/ -ads--CSideTabBar{ +ads--CAutoHideBar{ background: palette(window); } -ads--CSideTabBar[sideTabBarArea="0"] { +ads--CAutoHideBar[sideTabBarArea="0"] { border-bottom: 1px solid palette(dark); } -ads--CSideTabBar[sideTabBarArea="1"] { +ads--CAutoHideBar[sideTabBarArea="1"] { border-right: 1px solid palette(dark); } -ads--CSideTabBar[sideTabBarArea="2"] { +ads--CAutoHideBar[sideTabBarArea="2"] { border-left: 1px solid palette(dark); } -ads--CSideTabBar[sideTabBarArea="3"] { +ads--CAutoHideBar[sideTabBarArea="3"] { border-top: 1px solid palette(dark); } diff --git a/src/stylesheets/default_linux.css b/src/stylesheets/default_linux.css index f8dedfe..0fac1fc 100644 --- a/src/stylesheets/default_linux.css +++ b/src/stylesheets/default_linux.css @@ -164,9 +164,9 @@ ads--CFloatingWidgetTitleBar { /***************************************************************************** - * CDockWidgetSideTab + * CAutoHideTab *****************************************************************************/ -ads--CDockWidgetSideTab { +ads--CAutoHideTab { qproperty-iconSize: 16px 16px;/* this is optional in case you would like to change icon size*/ padding-left: 2px; padding-right: 0px; @@ -176,64 +176,64 @@ ads--CDockWidgetSideTab { border: none; } -ads--CDockWidgetSideTab[sideTabBarArea="1"], -ads--CDockWidgetSideTab[sideTabBarArea="3"] { +ads--CAutoHideTab[sideTabBarArea="1"], +ads--CAutoHideTab[sideTabBarArea="3"] { border-bottom: 5px solid rgba(0, 0, 0, 48); } -ads--CDockWidgetSideTab[sideTabBarArea="0"], -ads--CDockWidgetSideTab[sideTabBarArea="2"] { +ads--CAutoHideTab[sideTabBarArea="0"], +ads--CAutoHideTab[sideTabBarArea="2"] { border-top: 5px solid rgba(0, 0, 0, 48); } -ads--CDockWidgetSideTab:hover[sideTabBarArea="0"], -ads--CDockWidgetSideTab:hover[sideTabBarArea="2"] { +ads--CAutoHideTab:hover[sideTabBarArea="0"], +ads--CAutoHideTab:hover[sideTabBarArea="2"] { border-top: 5px solid palette(highlight); color: palette(highlight); } -ads--CDockWidgetSideTab:hover[sideTabBarArea="1"], -ads--CDockWidgetSideTab:hover[sideTabBarArea="3"] { +ads--CAutoHideTab:hover[sideTabBarArea="1"], +ads--CAutoHideTab:hover[sideTabBarArea="3"] { border-bottom: 5px solid palette(highlight); color: palette(highlight); } -ads--CDockWidgetSideTab[sideTabBarArea="0"][activeTab="true"], -ads--CDockWidgetSideTab[sideTabBarArea="2"][activeTab="true"] { +ads--CAutoHideTab[sideTabBarArea="0"][activeTab="true"], +ads--CAutoHideTab[sideTabBarArea="2"][activeTab="true"] { border-top: 5px solid palette(highlight); } -ads--CDockWidgetSideTab[sideTabBarArea="1"][activeTab="true"], -ads--CDockWidgetSideTab[sideTabBarArea="3"][activeTab="true"] { +ads--CAutoHideTab[sideTabBarArea="1"][activeTab="true"], +ads--CAutoHideTab[sideTabBarArea="3"][activeTab="true"] { border-bottom: 5px solid palette(highlight); } /***************************************************************************** - * CSideTabBar + * CAutoHideBar *****************************************************************************/ -ads--CSideTabBar{ +ads--CAutoHideBar{ background: palette(window); } -ads--CSideTabBar[sideTabBarArea="0"] { +ads--CAutoHideBar[sideTabBarArea="0"] { border-bottom: 1px solid palette(dark); } -ads--CSideTabBar[sideTabBarArea="1"] { +ads--CAutoHideBar[sideTabBarArea="1"] { border-right: 1px solid palette(dark); } -ads--CSideTabBar[sideTabBarArea="2"] { +ads--CAutoHideBar[sideTabBarArea="2"] { border-left: 1px solid palette(dark); } -ads--CSideTabBar[sideTabBarArea="3"] { +ads--CAutoHideBar[sideTabBarArea="3"] { border-top: 1px solid palette(dark); } diff --git a/src/stylesheets/focus_highlighting.css b/src/stylesheets/focus_highlighting.css index 34ece19..a1ebd5a 100644 --- a/src/stylesheets/focus_highlighting.css +++ b/src/stylesheets/focus_highlighting.css @@ -165,15 +165,15 @@ QScrollArea#dockWidgetScrollArea { /***************************************************************************** - * CDockWidgetSideTab + * CAutoHideTab *****************************************************************************/ -ads--CDockWidgetSideTab { +ads--CAutoHideTab { /*background: palette(window);*/ qproperty-iconSize: 16px 16px;/* this is optional in case you would like to change icon size*/ } -ads--CDockWidgetSideTab { +ads--CAutoHideTab { background: none; border: none; padding-left: 2px; @@ -182,16 +182,16 @@ ads--CDockWidgetSideTab { } -ads--CDockWidgetSideTab[sideTabBarArea="0"], -ads--CDockWidgetSideTab[sideTabBarArea="2"] { +ads--CAutoHideTab[sideTabBarArea="0"], +ads--CAutoHideTab[sideTabBarArea="2"] { border-top: 5px solid rgba(0, 0, 0, 48); margin-right: 6px; min-height: 20; } -ads--CDockWidgetSideTab[sideTabBarArea="1"], -ads--CDockWidgetSideTab[sideTabBarArea="3"] { +ads--CAutoHideTab[sideTabBarArea="1"], +ads--CAutoHideTab[sideTabBarArea="3"] { border-bottom: 5px solid rgba(0, 0, 0, 48); margin-right: 6px; min-height: 20; @@ -199,52 +199,52 @@ ads--CDockWidgetSideTab[sideTabBarArea="3"] { -ads--CDockWidgetSideTab:hover[sideTabBarArea="0"], -ads--CDockWidgetSideTab:hover[sideTabBarArea="2"] { +ads--CAutoHideTab:hover[sideTabBarArea="0"], +ads--CAutoHideTab:hover[sideTabBarArea="2"] { border-top: 5px solid palette(highlight); color: palette(highlight); } -ads--CDockWidgetSideTab:hover[sideTabBarArea="1"], -ads--CDockWidgetSideTab:hover[sideTabBarArea="3"] { +ads--CAutoHideTab:hover[sideTabBarArea="1"], +ads--CAutoHideTab:hover[sideTabBarArea="3"] { border-bottom: 5px solid palette(highlight); color: palette(highlight); } -ads--CDockWidgetSideTab[sideTabBarArea="0"][activeTab="true"], -ads--CDockWidgetSideTab[sideTabBarArea="2"][activeTab="true"] { +ads--CAutoHideTab[sideTabBarArea="0"][activeTab="true"], +ads--CAutoHideTab[sideTabBarArea="2"][activeTab="true"] { border-top: 5px solid palette(highlight); } -ads--CDockWidgetSideTab[sideTabBarArea="1"][activeTab="true"], -ads--CDockWidgetSideTab[sideTabBarArea="3"][activeTab="true"] { +ads--CAutoHideTab[sideTabBarArea="1"][activeTab="true"], +ads--CAutoHideTab[sideTabBarArea="3"][activeTab="true"] { border-bottom: 5px solid palette(highlight); } /***************************************************************************** - * CSideTabBar + * CAutoHideBar *****************************************************************************/ -ads--CSideTabBar{ +ads--CAutoHideBar{ background: palette(window); } -ads--CSideTabBar[sideTabBarArea="0"] { +ads--CAutoHideBar[sideTabBarArea="0"] { border-bottom: 1px solid palette(dark); } -ads--CSideTabBar[sideTabBarArea="1"] { +ads--CAutoHideBar[sideTabBarArea="1"] { border-right: 1px solid palette(dark); } -ads--CSideTabBar[sideTabBarArea="2"] { +ads--CAutoHideBar[sideTabBarArea="2"] { border-left: 1px solid palette(dark); } -ads--CSideTabBar[sideTabBarArea="3"] { +ads--CAutoHideBar[sideTabBarArea="3"] { border-top: 1px solid palette(dark); } diff --git a/src/stylesheets/focus_highlighting_linux.css b/src/stylesheets/focus_highlighting_linux.css index dfa8a10..03e88e9 100644 --- a/src/stylesheets/focus_highlighting_linux.css +++ b/src/stylesheets/focus_highlighting_linux.css @@ -240,9 +240,9 @@ ads--CFloatingDockContainer[isActiveWindow="true"] #floatingTitleMaximizeButton: /***************************************************************************** - * CDockWidgetSideTab + * CAutoHideTab *****************************************************************************/ -ads--CDockWidgetSideTab { +ads--CAutoHideTab { qproperty-iconSize: 16px 16px;/* this is optional in case you would like to change icon size*/ padding-left: 2px; padding-right: 0px; @@ -252,64 +252,64 @@ ads--CDockWidgetSideTab { border: none; } -ads--CDockWidgetSideTab[sideTabBarArea="1"], -ads--CDockWidgetSideTab[sideTabBarArea="3"] { +ads--CAutoHideTab[sideTabBarArea="1"], +ads--CAutoHideTab[sideTabBarArea="3"] { border-bottom: 5px solid rgba(0, 0, 0, 48); } -ads--CDockWidgetSideTab[sideTabBarArea="0"], -ads--CDockWidgetSideTab[sideTabBarArea="2"] { +ads--CAutoHideTab[sideTabBarArea="0"], +ads--CAutoHideTab[sideTabBarArea="2"] { border-top: 5px solid rgba(0, 0, 0, 48); } -ads--CDockWidgetSideTab:hover[sideTabBarArea="0"], -ads--CDockWidgetSideTab:hover[sideTabBarArea="2"] { +ads--CAutoHideTab:hover[sideTabBarArea="0"], +ads--CAutoHideTab:hover[sideTabBarArea="2"] { border-top: 5px solid palette(highlight); color: palette(highlight); } -ads--CDockWidgetSideTab:hover[sideTabBarArea="1"], -ads--CDockWidgetSideTab:hover[sideTabBarArea="3"] { +ads--CAutoHideTab:hover[sideTabBarArea="1"], +ads--CAutoHideTab:hover[sideTabBarArea="3"] { border-bottom: 5px solid palette(highlight); color: palette(highlight); } -ads--CDockWidgetSideTab[sideTabBarArea="0"][activeTab="true"], -ads--CDockWidgetSideTab[sideTabBarArea="2"][activeTab="true"] { +ads--CAutoHideTab[sideTabBarArea="0"][activeTab="true"], +ads--CAutoHideTab[sideTabBarArea="2"][activeTab="true"] { border-top: 5px solid palette(highlight); } -ads--CDockWidgetSideTab[sideTabBarArea="1"][activeTab="true"], -ads--CDockWidgetSideTab[sideTabBarArea="3"][activeTab="true"] { +ads--CAutoHideTab[sideTabBarArea="1"][activeTab="true"], +ads--CAutoHideTab[sideTabBarArea="3"][activeTab="true"] { border-bottom: 5px solid palette(highlight); } /***************************************************************************** - * CSideTabBar + * CAutoHideBar *****************************************************************************/ -ads--CSideTabBar{ +ads--CAutoHideBar{ background: palette(window); } -ads--CSideTabBar[sideTabBarArea="0"] { +ads--CAutoHideBar[sideTabBarArea="0"] { border-bottom: 1px solid palette(dark); } -ads--CSideTabBar[sideTabBarArea="1"] { +ads--CAutoHideBar[sideTabBarArea="1"] { border-right: 1px solid palette(dark); } -ads--CSideTabBar[sideTabBarArea="2"] { +ads--CAutoHideBar[sideTabBarArea="2"] { border-left: 1px solid palette(dark); } -ads--CSideTabBar[sideTabBarArea="3"] { +ads--CAutoHideBar[sideTabBarArea="3"] { border-top: 1px solid palette(dark); } diff --git a/src/stylesheets/visual_studio_light.css b/src/stylesheets/visual_studio_light.css index 8e01c52..892ab07 100644 --- a/src/stylesheets/visual_studio_light.css +++ b/src/stylesheets/visual_studio_light.css @@ -149,13 +149,13 @@ ads--CDockAreaWidget[focused="true"] ads--CDockAreaTitleBar { * Styling of auto hide functionality *---------------------------------------------------------------------------- */ -ads--CDockWidgetSideTab { +ads--CAutoHideTab { /*background: palette(window);*/ qproperty-iconSize: 16px 16px;/* this is optional in case you would like to change icon size*/ } -ads--CDockWidgetSideTab +ads--CAutoHideTab { background: none; border: none; @@ -164,8 +164,8 @@ ads--CDockWidgetSideTab text-align: center; } -ads--CDockWidgetSideTab[sideTabBarArea="0"], -ads--CDockWidgetSideTab[sideTabBarArea="2"] +ads--CAutoHideTab[sideTabBarArea="0"], +ads--CAutoHideTab[sideTabBarArea="2"] { border-top: 5px solid rgba(0, 0, 0, 48); margin-right: 6px; @@ -173,8 +173,8 @@ ads--CDockWidgetSideTab[sideTabBarArea="2"] } -ads--CDockWidgetSideTab[sideTabBarArea="1"], -ads--CDockWidgetSideTab[sideTabBarArea="3"] +ads--CAutoHideTab[sideTabBarArea="1"], +ads--CAutoHideTab[sideTabBarArea="3"] { border-bottom: 5px solid rgba(0, 0, 0, 48); margin-right: 6px; @@ -183,30 +183,30 @@ ads--CDockWidgetSideTab[sideTabBarArea="3"] -ads--CDockWidgetSideTab:hover[sideTabBarArea="0"], -ads--CDockWidgetSideTab:hover[sideTabBarArea="2"] +ads--CAutoHideTab:hover[sideTabBarArea="0"], +ads--CAutoHideTab:hover[sideTabBarArea="2"] { border-top: 5px solid palette(highlight); color: palette(highlight); } -ads--CDockWidgetSideTab:hover[sideTabBarArea="1"], -ads--CDockWidgetSideTab:hover[sideTabBarArea="3"] +ads--CAutoHideTab:hover[sideTabBarArea="1"], +ads--CAutoHideTab:hover[sideTabBarArea="3"] { border-bottom: 5px solid palette(highlight); color: palette(highlight); } -ads--CDockWidgetSideTab[sideTabBarArea="0"][activeTab="true"], -ads--CDockWidgetSideTab[sideTabBarArea="2"][activeTab="true"] +ads--CAutoHideTab[sideTabBarArea="0"][activeTab="true"], +ads--CAutoHideTab[sideTabBarArea="2"][activeTab="true"] { border-top: 5px solid palette(highlight); } -ads--CDockWidgetSideTab[sideTabBarArea="1"][activeTab="true"], -ads--CDockWidgetSideTab[sideTabBarArea="3"][activeTab="true"] +ads--CAutoHideTab[sideTabBarArea="1"][activeTab="true"], +ads--CAutoHideTab[sideTabBarArea="3"][activeTab="true"] { border-bottom: 5px solid palette(highlight); } From 075ef6187f1abaa8b78e074405f182a63cc624ad Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Tue, 1 Nov 2022 13:34:08 +0100 Subject: [PATCH 20/22] Refactoring: renamed CDockWidgetSideTab to CAutoHideTab and CSideTabBar top CAutoHideSideBar --- src/AutoHideDockContainer.cpp | 16 ++-- src/AutoHideDockContainer.h | 12 ++- src/AutoHideSideBar.cpp | 34 ++----- src/AutoHideSideBar.h | 27 +++--- src/AutoHideTab.cpp | 93 +++++++++++--------- src/AutoHideTab.h | 12 +-- src/CMakeLists.txt | 8 +- src/DockContainerWidget.cpp | 2 +- src/stylesheets/default.css | 44 ++++----- src/stylesheets/default_linux.css | 44 ++++----- src/stylesheets/focus_highlighting.css | 44 ++++----- src/stylesheets/focus_highlighting_linux.css | 44 ++++----- src/stylesheets/visual_studio_light.css | 26 +++--- 13 files changed, 199 insertions(+), 207 deletions(-) diff --git a/src/AutoHideDockContainer.cpp b/src/AutoHideDockContainer.cpp index 14d3c8a..7cb2ee1 100644 --- a/src/AutoHideDockContainer.cpp +++ b/src/AutoHideDockContainer.cpp @@ -227,7 +227,7 @@ void CAutoHideDockContainer::updateSize() auto dockContainerParent = parentContainer(); auto rect = dockContainerParent->contentRect(); - switch (sideTabBarArea()) + switch (sideBarLocation()) { case SideBarLocation::Top: resize(rect.width(), qMin(rect.height(), d->Size.height() - ResizeMargin)); @@ -271,18 +271,23 @@ CAutoHideDockContainer::~CAutoHideDockContainer() parentContainer()->removeAutoHideWidget(this); } + if (d->SideTab) + { + delete d->SideTab; + } + delete d; } //============================================================================ -CAutoHideSideBar* CAutoHideDockContainer::sideTabBar() const +CAutoHideSideBar* CAutoHideDockContainer::sideBar() const { return parentContainer()->sideTabBar(d->SideTabBarArea); } //============================================================================ -CAutoHideTab* CAutoHideDockContainer::sideTab() const +CAutoHideTab* CAutoHideDockContainer::autoHideTab() const { return d->SideTab; } @@ -327,7 +332,7 @@ void CAutoHideDockContainer::addDockWidget(CDockWidget* DockWidget) //============================================================================ -SideBarLocation CAutoHideDockContainer::sideTabBarArea() const +SideBarLocation CAutoHideDockContainer::sideBarLocation() const { return d->SideTabBarArea; } @@ -356,9 +361,10 @@ void CAutoHideDockContainer::cleanupAndDelete() const auto dockWidget = d->DockWidget; if (dockWidget) { + auto SideTab = d->SideTab; SideTab->removeFromSideBar(); - SideTab->setParent(dockWidget); + SideTab->setParent(nullptr); SideTab->hide(); } diff --git a/src/AutoHideDockContainer.h b/src/AutoHideDockContainer.h index 4943cd6..9823ac0 100644 --- a/src/AutoHideDockContainer.h +++ b/src/AutoHideDockContainer.h @@ -53,7 +53,7 @@ struct SideTabBarPrivate; class ADS_EXPORT CAutoHideDockContainer : public QFrame { Q_OBJECT - Q_PROPERTY(int sideTabBarArea READ sideTabBarArea) + Q_PROPERTY(int sideBarLocation READ sideBarLocation) private: AutoHideDockContainerPrivate* d; ///< private data (pimpl) friend struct AutoHideDockContainerPrivate; @@ -63,6 +63,10 @@ private: protected: bool eventFilter(QObject* watched, QEvent* event) override; void resizeEvent(QResizeEvent* event) override; + + /** + * Updates the size considering the size limits and the resize margins + */ void updateSize(); /* @@ -92,12 +96,12 @@ public: /** * Get's the side tab bar */ - CAutoHideSideBar* sideTabBar() const; + CAutoHideSideBar* sideBar() const; /** * Returns the side tab */ - CAutoHideTab* sideTab() const; + CAutoHideTab* autoHideTab() const; /** * Get's the dock widget in this dock container @@ -112,7 +116,7 @@ public: /** * Returns the side tab bar area of this Auto Hide dock container */ - SideBarLocation sideTabBarArea() const; + SideBarLocation sideBarLocation() const; /** * Returns the dock area widget of this Auto Hide dock container diff --git a/src/AutoHideSideBar.cpp b/src/AutoHideSideBar.cpp index 7b0a5c0..e384624 100644 --- a/src/AutoHideSideBar.cpp +++ b/src/AutoHideSideBar.cpp @@ -128,11 +128,10 @@ CAutoHideSideBar::~CAutoHideSideBar() //============================================================================ -void CAutoHideSideBar::insertSideTab(int Index, CAutoHideTab* SideTab) +void CAutoHideSideBar::insertTab(int Index, CAutoHideTab* SideTab) { SideTab->installEventFilter(this); SideTab->setSideBar(this); - SideTab->updateOrientationForArea(d->SideTabArea); d->TabsLayout->insertWidget(Index, SideTab); show(); } @@ -143,22 +142,14 @@ CAutoHideDockContainer* CAutoHideSideBar::insertDockWidget(int Index, CDockWidge { auto AutoHideContainer = new CAutoHideDockContainer(DockWidget, d->SideTabArea, d->ContainerWidget); DockWidget->dockManager()->dockFocusController()->clearDockWidgetFocus(DockWidget); - auto Tab = AutoHideContainer->sideTab(); - insertSideTab(Index, Tab); + auto Tab = AutoHideContainer->autoHideTab(); + insertTab(Index, Tab); return AutoHideContainer; } //============================================================================ -void CAutoHideSideBar::removeDockWidget(CDockWidget* DockWidget) -{ - Q_UNUSED(DockWidget); - // TODO implement -} - - -//============================================================================ -void CAutoHideSideBar::removeSideTab(CAutoHideTab* SideTab) +void CAutoHideSideBar::removeTab(CAutoHideTab* SideTab) { SideTab->removeEventFilter(this); d->TabsLayout->removeWidget(SideTab); @@ -226,19 +217,6 @@ bool CAutoHideSideBar::eventFilter(QObject *watched, QEvent *event) return false; } - -//============================================================================ -void CAutoHideSideBar::paintEvent(QPaintEvent* event) -{ - Q_UNUSED(event) - - QStyleOption option; - option.initFrom(this); - QPainter painter(this); - style()->drawPrimitive(QStyle::PE_Widget, &option, &painter, this); -} - - //============================================================================ Qt::Orientation CAutoHideSideBar::orientation() const { @@ -261,7 +239,7 @@ int CAutoHideSideBar::tabCount() const //============================================================================ -SideBarLocation CAutoHideSideBar::sideBarArea() const +SideBarLocation CAutoHideSideBar::sideBarLocation() const { return d->SideTabArea; } @@ -276,7 +254,7 @@ void CAutoHideSideBar::saveState(QXmlStreamWriter& s) const } s.writeStartElement("SideBar"); - s.writeAttribute("Area", QString::number(sideBarArea())); + s.writeAttribute("Area", QString::number(sideBarLocation())); s.writeAttribute("Tabs", QString::number(tabCount())); for (auto i = 0; i < tabCount(); ++i) diff --git a/src/AutoHideSideBar.h b/src/AutoHideSideBar.h index c27820c..385bd38 100644 --- a/src/AutoHideSideBar.h +++ b/src/AutoHideSideBar.h @@ -54,7 +54,7 @@ class CDockingStateReader; class ADS_EXPORT CAutoHideSideBar : public QFrame { Q_OBJECT - Q_PROPERTY(int sideBarArea READ sideBarArea) + Q_PROPERTY(int sideBarLocation READ sideBarLocation) Q_PROPERTY(Qt::Orientation orientation READ orientation) private: @@ -64,7 +64,6 @@ private: friend DockContainerWidgetPrivate; protected: - virtual void paintEvent(QPaintEvent* event) override; virtual bool event(QEvent* e) override; virtual bool eventFilter(QObject *watched, QEvent *event) override; @@ -73,6 +72,12 @@ protected: */ void saveState(QXmlStreamWriter& Stream) const; + /** + * Inserts the given dock widget tab at the given position. + * An Index value of -1 appends the side tab at the end. + */ + void insertTab(int Index, CAutoHideTab* SideTab); + public: using Super = QFrame; @@ -86,26 +91,18 @@ public: */ virtual ~CAutoHideSideBar(); - /** - * Inserts the given dock widget tab at the given position. - */ - void insertSideTab(int Index, CAutoHideTab* SideTab); - /** * Removes the given DockWidgetSideTab from the tabbar */ - void removeSideTab(CAutoHideTab* SideTab); + void removeTab(CAutoHideTab* SideTab); /** - * Insert dock widget + * Insert dock widget into the side bar. + * The function creates the auto hide dock container, inserts the + * auto hide tab */ CAutoHideDockContainer* insertDockWidget(int Index, CDockWidget* DockWidget); - /** - * Remove dock widget from sidebar - */ - void removeDockWidget(CDockWidget* DockWidget); - /** * Returns orientation of side tab. */ @@ -124,7 +121,7 @@ public: /** * Getter for side tab bar area property */ - SideBarLocation sideBarArea() const; + SideBarLocation sideBarLocation() const; Q_SIGNALS: void sideTabAutoHideToggleRequested(); diff --git a/src/AutoHideTab.cpp b/src/AutoHideTab.cpp index 8667657..4b901ef 100644 --- a/src/AutoHideTab.cpp +++ b/src/AutoHideTab.cpp @@ -53,6 +53,12 @@ struct AutoHideTabPrivate * Private data constructor */ AutoHideTabPrivate(CAutoHideTab* _public); + + /** + * Update the orientation, visibility and spacing based on the area of + * the side bar + */ + void updateOrientation(); }; // struct DockWidgetTabPrivate @@ -64,10 +70,53 @@ AutoHideTabPrivate::AutoHideTabPrivate(CAutoHideTab* _public) : } +//============================================================================ +void AutoHideTabPrivate::updateOrientation() +{ + auto area = SideBar->sideBarLocation(); + _this->setOrientation((area == Bottom || area == Top) ? Qt::Horizontal : Qt::Vertical); + + if (_this->icon().isNull()) + { + return; + } + + bool IconOnly = false; + switch (area) + { + case SideBarLocation::Left: + IconOnly = CDockManager::testConfigFlag(CDockManager::LeftSideBarIconOnly); + break; + + case SideBarLocation::Right: + IconOnly = CDockManager::testConfigFlag(CDockManager::RightSideBarIconOnly); + break; + + case SideBarLocation::Top: + IconOnly = CDockManager::testConfigFlag(CDockManager::BottomSideBarIconOnly); + break; + + case SideBarLocation::Bottom: + IconOnly = CDockManager::testConfigFlag(CDockManager::TopSideBarIconOnly); + break; + } + + if (IconOnly) + { + _this->setText(""); + _this->setOrientation(Qt::Horizontal); + } +} + + //============================================================================ void CAutoHideTab::setSideBar(CAutoHideSideBar* SideTabBar) { d->SideBar = SideTabBar; + if (d->SideBar) + { + d->updateOrientation(); + } } @@ -78,7 +127,7 @@ void CAutoHideTab::removeFromSideBar() { return; } - d->SideBar->removeSideTab(this); + d->SideBar->removeTab(this); setSideBar(nullptr); } @@ -109,11 +158,11 @@ void CAutoHideTab::updateStyle() //============================================================================ -SideBarLocation CAutoHideTab::sideTabBarArea() const +SideBarLocation CAutoHideTab::sideBarLocation() const { if (d->SideBar) { - return d->SideBar->sideBarArea(); + return d->SideBar->sideBarLocation(); } return Left; @@ -137,44 +186,6 @@ Qt::Orientation CAutoHideTab::orientation() const } -//============================================================================ -void CAutoHideTab::updateOrientationForArea(SideBarLocation area) -{ - setOrientation((area == Bottom || area == Top) ? Qt::Horizontal : Qt::Vertical); - - if (icon().isNull()) - { - return; - } - - bool IconOnly = false; - switch (area) - { - case SideBarLocation::Left: - IconOnly = CDockManager::testConfigFlag(CDockManager::LeftSideBarIconOnly); - break; - - case SideBarLocation::Right: - IconOnly = CDockManager::testConfigFlag(CDockManager::RightSideBarIconOnly); - break; - - case SideBarLocation::Top: - IconOnly = CDockManager::testConfigFlag(CDockManager::BottomSideBarIconOnly); - break; - - case SideBarLocation::Bottom: - IconOnly = CDockManager::testConfigFlag(CDockManager::TopSideBarIconOnly); - break; - } - - if (IconOnly) - { - setText(""); - setOrientation(Qt::Horizontal); - } -} - - //============================================================================ bool CAutoHideTab::isActiveTab() const { diff --git a/src/AutoHideTab.h b/src/AutoHideTab.h index d616415..ba20bad 100644 --- a/src/AutoHideTab.h +++ b/src/AutoHideTab.h @@ -50,7 +50,7 @@ class ADS_EXPORT CAutoHideTab : public CPushButton { Q_OBJECT - Q_PROPERTY(int sideTabBarArea READ sideTabBarArea) + Q_PROPERTY(int sideBarLocation READ sideBarLocation) Q_PROPERTY(Qt::Orientation orientation READ orientation) Q_PROPERTY(bool activeTab READ isActiveTab) @@ -91,7 +91,7 @@ public: /** * Getter for side tab bar area property */ - SideBarLocation sideTabBarArea() const; + SideBarLocation sideBarLocation() const; /** * Set orientation vertical or horizontal @@ -104,12 +104,8 @@ public: Qt::Orientation orientation() const; /** - * Update the orientation, visibility and spacing based on the area and the config - */ - void updateOrientationForArea(SideBarLocation area); - - /** - * Returns true, if this is the active tab. The tab is active if the auto hide widget is visible + * Returns true, if this is the active tab. The tab is active if the auto + * hide widget is visible */ bool isActiveTab() const; diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 70c0276..ba62e48 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -27,8 +27,8 @@ set(ads_SRCS FloatingDragPreview.cpp IconProvider.cpp DockComponentsFactory.cpp - SideTabBar.cpp - DockWidgetSideTab.cpp + AutoHideSideBar.cpp + AutoHideTab.cpp AutoHideDockContainer.cpp PushButton.cpp ResizeHandle.cpp @@ -53,8 +53,8 @@ set(ads_HEADERS FloatingDragPreview.h IconProvider.h DockComponentsFactory.h - SideTabBar.h - DockWidgetSideTab.h + AutoHideSideBar.h + AutoHideTab.h AutoHideDockContainer.h PushButton.h ResizeHandle.h diff --git a/src/DockContainerWidget.cpp b/src/DockContainerWidget.cpp index 4a6ef86..459b166 100644 --- a/src/DockContainerWidget.cpp +++ b/src/DockContainerWidget.cpp @@ -1714,7 +1714,7 @@ void CDockContainerWidget::dropFloatingWidget(CFloatingDockContainer* FloatingWi auto autoHideWidgets = FloatingWidget->dockContainer()->autoHideWidgets(); for (const auto autohideWidget : autoHideWidgets) { - createAndSetupAutoHideContainer(autohideWidget->sideTabBarArea(), autohideWidget->dockWidget(), autohideWidget->dockWidget()->autoHideInsertOrder()); + createAndSetupAutoHideContainer(autohideWidget->sideBarLocation(), autohideWidget->dockWidget(), autohideWidget->dockWidget()->autoHideInsertOrder()); } if (DockArea) diff --git a/src/stylesheets/default.css b/src/stylesheets/default.css index c7e067b..155de9e 100644 --- a/src/stylesheets/default.css +++ b/src/stylesheets/default.css @@ -142,66 +142,66 @@ ads--CAutoHideTab { } -ads--CAutoHideTab[sideTabBarArea="0"], -ads--CAutoHideTab[sideTabBarArea="2"] { +ads--CAutoHideTab[sideBarLocation="0"], +ads--CAutoHideTab[sideBarLocation="2"] { border-top: 5px solid rgba(0, 0, 0, 48); } -ads--CAutoHideTab[sideTabBarArea="1"], -ads--CAutoHideTab[sideTabBarArea="3"] { +ads--CAutoHideTab[sideBarLocation="1"], +ads--CAutoHideTab[sideBarLocation="3"] { border-bottom: 5px solid rgba(0, 0, 0, 48); } -ads--CAutoHideTab:hover[sideTabBarArea="0"], -ads--CAutoHideTab:hover[sideTabBarArea="2"] { +ads--CAutoHideTab:hover[sideBarLocation="0"], +ads--CAutoHideTab:hover[sideBarLocation="2"] { border-top: 5px solid palette(highlight); color: palette(highlight); } -ads--CAutoHideTab:hover[sideTabBarArea="1"], -ads--CAutoHideTab:hover[sideTabBarArea="3"] { +ads--CAutoHideTab:hover[sideBarLocation="1"], +ads--CAutoHideTab:hover[sideBarLocation="3"] { border-bottom: 5px solid palette(highlight); color: palette(highlight); } -ads--CAutoHideTab[sideTabBarArea="0"][activeTab="true"], -ads--CAutoHideTab[sideTabBarArea="2"][activeTab="true"] { +ads--CAutoHideTab[sideBarLocation="0"][activeTab="true"], +ads--CAutoHideTab[sideBarLocation="2"][activeTab="true"] { border-top: 5px solid palette(highlight); } -ads--CAutoHideTab[sideTabBarArea="1"][activeTab="true"], -ads--CAutoHideTab[sideTabBarArea="3"][activeTab="true"] { +ads--CAutoHideTab[sideBarLocation="1"][activeTab="true"], +ads--CAutoHideTab[sideBarLocation="3"][activeTab="true"] { border-bottom: 5px solid palette(highlight); } /***************************************************************************** - * CAutoHideBar + * CAutoHideSideBar *****************************************************************************/ -ads--CAutoHideBar{ +ads--CAutoHideSideBar{ background: palette(window); } -ads--CAutoHideBar[sideTabBarArea="0"] { +ads--CAutoHideSideBar[sideBarLocation="0"] { border-bottom: 1px solid palette(dark); } -ads--CAutoHideBar[sideTabBarArea="1"] { +ads--CAutoHideSideBar[sideBarLocation="1"] { border-right: 1px solid palette(dark); } -ads--CAutoHideBar[sideTabBarArea="2"] { +ads--CAutoHideSideBar[sideBarLocation="2"] { border-left: 1px solid palette(dark); } -ads--CAutoHideBar[sideTabBarArea="3"] { +ads--CAutoHideSideBar[sideBarLocation="3"] { border-top: 1px solid palette(dark); } @@ -278,19 +278,19 @@ ads--CResizeHandle { } -ads--CAutoHideDockContainer[sideTabBarArea="0"] ads--CResizeHandle { +ads--CAutoHideDockContainer[sideBarLocation="0"] ads--CResizeHandle { border-top: 1px solid palette(dark); } -ads--CAutoHideDockContainer[sideTabBarArea="1"] ads--CResizeHandle { +ads--CAutoHideDockContainer[sideBarLocation="1"] ads--CResizeHandle { border-left: 1px solid palette(dark); } -ads--CAutoHideDockContainer[sideTabBarArea="2"] ads--CResizeHandle { +ads--CAutoHideDockContainer[sideBarLocation="2"] ads--CResizeHandle { border-right: 1px solid palette(dark); } -ads--CAutoHideDockContainer[sideTabBarArea="3"] ads--CResizeHandle { +ads--CAutoHideDockContainer[sideBarLocation="3"] ads--CResizeHandle { border-top: 1px solid palette(dark); } diff --git a/src/stylesheets/default_linux.css b/src/stylesheets/default_linux.css index 0fac1fc..28d2b5a 100644 --- a/src/stylesheets/default_linux.css +++ b/src/stylesheets/default_linux.css @@ -176,64 +176,64 @@ ads--CAutoHideTab { border: none; } -ads--CAutoHideTab[sideTabBarArea="1"], -ads--CAutoHideTab[sideTabBarArea="3"] { +ads--CAutoHideTab[sideBarLocation="1"], +ads--CAutoHideTab[sideBarLocation="3"] { border-bottom: 5px solid rgba(0, 0, 0, 48); } -ads--CAutoHideTab[sideTabBarArea="0"], -ads--CAutoHideTab[sideTabBarArea="2"] { +ads--CAutoHideTab[sideBarLocation="0"], +ads--CAutoHideTab[sideBarLocation="2"] { border-top: 5px solid rgba(0, 0, 0, 48); } -ads--CAutoHideTab:hover[sideTabBarArea="0"], -ads--CAutoHideTab:hover[sideTabBarArea="2"] { +ads--CAutoHideTab:hover[sideBarLocation="0"], +ads--CAutoHideTab:hover[sideBarLocation="2"] { border-top: 5px solid palette(highlight); color: palette(highlight); } -ads--CAutoHideTab:hover[sideTabBarArea="1"], -ads--CAutoHideTab:hover[sideTabBarArea="3"] { +ads--CAutoHideTab:hover[sideBarLocation="1"], +ads--CAutoHideTab:hover[sideBarLocation="3"] { border-bottom: 5px solid palette(highlight); color: palette(highlight); } -ads--CAutoHideTab[sideTabBarArea="0"][activeTab="true"], -ads--CAutoHideTab[sideTabBarArea="2"][activeTab="true"] { +ads--CAutoHideTab[sideBarLocation="0"][activeTab="true"], +ads--CAutoHideTab[sideBarLocation="2"][activeTab="true"] { border-top: 5px solid palette(highlight); } -ads--CAutoHideTab[sideTabBarArea="1"][activeTab="true"], -ads--CAutoHideTab[sideTabBarArea="3"][activeTab="true"] { +ads--CAutoHideTab[sideBarLocation="1"][activeTab="true"], +ads--CAutoHideTab[sideBarLocation="3"][activeTab="true"] { border-bottom: 5px solid palette(highlight); } /***************************************************************************** - * CAutoHideBar + * CAutoHideSideBar *****************************************************************************/ -ads--CAutoHideBar{ +ads--CAutoHideSideBar{ background: palette(window); } -ads--CAutoHideBar[sideTabBarArea="0"] { +ads--CAutoHideSideBar[sideBarLocation="0"] { border-bottom: 1px solid palette(dark); } -ads--CAutoHideBar[sideTabBarArea="1"] { +ads--CAutoHideSideBar[sideBarLocation="1"] { border-right: 1px solid palette(dark); } -ads--CAutoHideBar[sideTabBarArea="2"] { +ads--CAutoHideSideBar[sideBarLocation="2"] { border-left: 1px solid palette(dark); } -ads--CAutoHideBar[sideTabBarArea="3"] { +ads--CAutoHideSideBar[sideBarLocation="3"] { border-top: 1px solid palette(dark); } @@ -310,19 +310,19 @@ ads--CResizeHandle { } -ads--CAutoHideDockContainer[sideTabBarArea="0"] ads--CResizeHandle { +ads--CAutoHideDockContainer[sideBarLocation="0"] ads--CResizeHandle { border-top: 1px solid palette(dark); } -ads--CAutoHideDockContainer[sideTabBarArea="1"] ads--CResizeHandle { +ads--CAutoHideDockContainer[sideBarLocation="1"] ads--CResizeHandle { border-left: 1px solid palette(dark); } -ads--CAutoHideDockContainer[sideTabBarArea="2"] ads--CResizeHandle { +ads--CAutoHideDockContainer[sideBarLocation="2"] ads--CResizeHandle { border-right: 1px solid palette(dark); } -ads--CAutoHideDockContainer[sideTabBarArea="3"] ads--CResizeHandle { +ads--CAutoHideDockContainer[sideBarLocation="3"] ads--CResizeHandle { border-top: 1px solid palette(dark); } diff --git a/src/stylesheets/focus_highlighting.css b/src/stylesheets/focus_highlighting.css index a1ebd5a..1e09c43 100644 --- a/src/stylesheets/focus_highlighting.css +++ b/src/stylesheets/focus_highlighting.css @@ -182,16 +182,16 @@ ads--CAutoHideTab { } -ads--CAutoHideTab[sideTabBarArea="0"], -ads--CAutoHideTab[sideTabBarArea="2"] { +ads--CAutoHideTab[sideBarLocation="0"], +ads--CAutoHideTab[sideBarLocation="2"] { border-top: 5px solid rgba(0, 0, 0, 48); margin-right: 6px; min-height: 20; } -ads--CAutoHideTab[sideTabBarArea="1"], -ads--CAutoHideTab[sideTabBarArea="3"] { +ads--CAutoHideTab[sideBarLocation="1"], +ads--CAutoHideTab[sideBarLocation="3"] { border-bottom: 5px solid rgba(0, 0, 0, 48); margin-right: 6px; min-height: 20; @@ -199,52 +199,52 @@ ads--CAutoHideTab[sideTabBarArea="3"] { -ads--CAutoHideTab:hover[sideTabBarArea="0"], -ads--CAutoHideTab:hover[sideTabBarArea="2"] { +ads--CAutoHideTab:hover[sideBarLocation="0"], +ads--CAutoHideTab:hover[sideBarLocation="2"] { border-top: 5px solid palette(highlight); color: palette(highlight); } -ads--CAutoHideTab:hover[sideTabBarArea="1"], -ads--CAutoHideTab:hover[sideTabBarArea="3"] { +ads--CAutoHideTab:hover[sideBarLocation="1"], +ads--CAutoHideTab:hover[sideBarLocation="3"] { border-bottom: 5px solid palette(highlight); color: palette(highlight); } -ads--CAutoHideTab[sideTabBarArea="0"][activeTab="true"], -ads--CAutoHideTab[sideTabBarArea="2"][activeTab="true"] { +ads--CAutoHideTab[sideBarLocation="0"][activeTab="true"], +ads--CAutoHideTab[sideBarLocation="2"][activeTab="true"] { border-top: 5px solid palette(highlight); } -ads--CAutoHideTab[sideTabBarArea="1"][activeTab="true"], -ads--CAutoHideTab[sideTabBarArea="3"][activeTab="true"] { +ads--CAutoHideTab[sideBarLocation="1"][activeTab="true"], +ads--CAutoHideTab[sideBarLocation="3"][activeTab="true"] { border-bottom: 5px solid palette(highlight); } /***************************************************************************** - * CAutoHideBar + * CAutoHideSideBar *****************************************************************************/ -ads--CAutoHideBar{ +ads--CAutoHideSideBar{ background: palette(window); } -ads--CAutoHideBar[sideTabBarArea="0"] { +ads--CAutoHideSideBar[sideBarLocation="0"] { border-bottom: 1px solid palette(dark); } -ads--CAutoHideBar[sideTabBarArea="1"] { +ads--CAutoHideSideBar[sideBarLocation="1"] { border-right: 1px solid palette(dark); } -ads--CAutoHideBar[sideTabBarArea="2"] { +ads--CAutoHideSideBar[sideBarLocation="2"] { border-left: 1px solid palette(dark); } -ads--CAutoHideBar[sideTabBarArea="3"] { +ads--CAutoHideSideBar[sideBarLocation="3"] { border-top: 1px solid palette(dark); } @@ -321,19 +321,19 @@ ads--CResizeHandle { } -ads--CAutoHideDockContainer[sideTabBarArea="0"] ads--CResizeHandle { +ads--CAutoHideDockContainer[sideBarLocation="0"] ads--CResizeHandle { border-top: 1px solid palette(dark); } -ads--CAutoHideDockContainer[sideTabBarArea="1"] ads--CResizeHandle { +ads--CAutoHideDockContainer[sideBarLocation="1"] ads--CResizeHandle { border-left: 1px solid palette(dark); } -ads--CAutoHideDockContainer[sideTabBarArea="2"] ads--CResizeHandle { +ads--CAutoHideDockContainer[sideBarLocation="2"] ads--CResizeHandle { border-right: 1px solid palette(dark); } -ads--CAutoHideDockContainer[sideTabBarArea="3"] ads--CResizeHandle { +ads--CAutoHideDockContainer[sideBarLocation="3"] ads--CResizeHandle { border-top: 1px solid palette(dark); } diff --git a/src/stylesheets/focus_highlighting_linux.css b/src/stylesheets/focus_highlighting_linux.css index 03e88e9..3a78cef 100644 --- a/src/stylesheets/focus_highlighting_linux.css +++ b/src/stylesheets/focus_highlighting_linux.css @@ -252,64 +252,64 @@ ads--CAutoHideTab { border: none; } -ads--CAutoHideTab[sideTabBarArea="1"], -ads--CAutoHideTab[sideTabBarArea="3"] { +ads--CAutoHideTab[sideBarLocation="1"], +ads--CAutoHideTab[sideBarLocation="3"] { border-bottom: 5px solid rgba(0, 0, 0, 48); } -ads--CAutoHideTab[sideTabBarArea="0"], -ads--CAutoHideTab[sideTabBarArea="2"] { +ads--CAutoHideTab[sideBarLocation="0"], +ads--CAutoHideTab[sideBarLocation="2"] { border-top: 5px solid rgba(0, 0, 0, 48); } -ads--CAutoHideTab:hover[sideTabBarArea="0"], -ads--CAutoHideTab:hover[sideTabBarArea="2"] { +ads--CAutoHideTab:hover[sideBarLocation="0"], +ads--CAutoHideTab:hover[sideBarLocation="2"] { border-top: 5px solid palette(highlight); color: palette(highlight); } -ads--CAutoHideTab:hover[sideTabBarArea="1"], -ads--CAutoHideTab:hover[sideTabBarArea="3"] { +ads--CAutoHideTab:hover[sideBarLocation="1"], +ads--CAutoHideTab:hover[sideBarLocation="3"] { border-bottom: 5px solid palette(highlight); color: palette(highlight); } -ads--CAutoHideTab[sideTabBarArea="0"][activeTab="true"], -ads--CAutoHideTab[sideTabBarArea="2"][activeTab="true"] { +ads--CAutoHideTab[sideBarLocation="0"][activeTab="true"], +ads--CAutoHideTab[sideBarLocation="2"][activeTab="true"] { border-top: 5px solid palette(highlight); } -ads--CAutoHideTab[sideTabBarArea="1"][activeTab="true"], -ads--CAutoHideTab[sideTabBarArea="3"][activeTab="true"] { +ads--CAutoHideTab[sideBarLocation="1"][activeTab="true"], +ads--CAutoHideTab[sideBarLocation="3"][activeTab="true"] { border-bottom: 5px solid palette(highlight); } /***************************************************************************** - * CAutoHideBar + * CAutoHideSideBar *****************************************************************************/ -ads--CAutoHideBar{ +ads--CAutoHideSideBar{ background: palette(window); } -ads--CAutoHideBar[sideTabBarArea="0"] { +ads--CAutoHideSideBar[sideBarLocation="0"] { border-bottom: 1px solid palette(dark); } -ads--CAutoHideBar[sideTabBarArea="1"] { +ads--CAutoHideSideBar[sideBarLocation="1"] { border-right: 1px solid palette(dark); } -ads--CAutoHideBar[sideTabBarArea="2"] { +ads--CAutoHideSideBar[sideBarLocation="2"] { border-left: 1px solid palette(dark); } -ads--CAutoHideBar[sideTabBarArea="3"] { +ads--CAutoHideSideBar[sideBarLocation="3"] { border-top: 1px solid palette(dark); } @@ -386,19 +386,19 @@ ads--CResizeHandle { } -ads--CAutoHideDockContainer[sideTabBarArea="0"] ads--CResizeHandle { +ads--CAutoHideDockContainer[sideBarLocation="0"] ads--CResizeHandle { border-top: 1px solid palette(dark); } -ads--CAutoHideDockContainer[sideTabBarArea="1"] ads--CResizeHandle { +ads--CAutoHideDockContainer[sideBarLocation="1"] ads--CResizeHandle { border-left: 1px solid palette(dark); } -ads--CAutoHideDockContainer[sideTabBarArea="2"] ads--CResizeHandle { +ads--CAutoHideDockContainer[sideBarLocation="2"] ads--CResizeHandle { border-right: 1px solid palette(dark); } -ads--CAutoHideDockContainer[sideTabBarArea="3"] ads--CResizeHandle { +ads--CAutoHideDockContainer[sideBarLocation="3"] ads--CResizeHandle { border-top: 1px solid palette(dark); } diff --git a/src/stylesheets/visual_studio_light.css b/src/stylesheets/visual_studio_light.css index 892ab07..845c3d6 100644 --- a/src/stylesheets/visual_studio_light.css +++ b/src/stylesheets/visual_studio_light.css @@ -164,8 +164,8 @@ ads--CAutoHideTab text-align: center; } -ads--CAutoHideTab[sideTabBarArea="0"], -ads--CAutoHideTab[sideTabBarArea="2"] +ads--CAutoHideTab[sideBarLocation="0"], +ads--CAutoHideTab[sideBarLocation="2"] { border-top: 5px solid rgba(0, 0, 0, 48); margin-right: 6px; @@ -173,8 +173,8 @@ ads--CAutoHideTab[sideTabBarArea="2"] } -ads--CAutoHideTab[sideTabBarArea="1"], -ads--CAutoHideTab[sideTabBarArea="3"] +ads--CAutoHideTab[sideBarLocation="1"], +ads--CAutoHideTab[sideBarLocation="3"] { border-bottom: 5px solid rgba(0, 0, 0, 48); margin-right: 6px; @@ -183,30 +183,30 @@ ads--CAutoHideTab[sideTabBarArea="3"] -ads--CAutoHideTab:hover[sideTabBarArea="0"], -ads--CAutoHideTab:hover[sideTabBarArea="2"] +ads--CAutoHideTab:hover[sideBarLocation="0"], +ads--CAutoHideTab:hover[sideBarLocation="2"] { border-top: 5px solid palette(highlight); color: palette(highlight); } -ads--CAutoHideTab:hover[sideTabBarArea="1"], -ads--CAutoHideTab:hover[sideTabBarArea="3"] +ads--CAutoHideTab:hover[sideBarLocation="1"], +ads--CAutoHideTab:hover[sideBarLocation="3"] { border-bottom: 5px solid palette(highlight); color: palette(highlight); } -ads--CAutoHideTab[sideTabBarArea="0"][activeTab="true"], -ads--CAutoHideTab[sideTabBarArea="2"][activeTab="true"] +ads--CAutoHideTab[sideBarLocation="0"][activeTab="true"], +ads--CAutoHideTab[sideBarLocation="2"][activeTab="true"] { border-top: 5px solid palette(highlight); } -ads--CAutoHideTab[sideTabBarArea="1"][activeTab="true"], -ads--CAutoHideTab[sideTabBarArea="3"][activeTab="true"] +ads--CAutoHideTab[sideBarLocation="1"][activeTab="true"], +ads--CAutoHideTab[sideBarLocation="3"][activeTab="true"] { border-bottom: 5px solid palette(highlight); } @@ -227,7 +227,7 @@ ads--CAutoHideDockContainer::handle:horizontal { } */ -/*ads--CAutoHideDockContainer[sideTabBarArea="0"]:handle { +/*ads--CAutoHideDockContainer[sideBarLocation="0"]:handle { border: 1px solid palette(dark); background: white; }*/ From da6bf2b9abe50920678c176a33a16a0862317747 Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Tue, 1 Nov 2022 13:36:32 +0100 Subject: [PATCH 21/22] Fixed typo --- src/ads_globals.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ads_globals.h b/src/ads_globals.h index 006ccb7..3260f87 100644 --- a/src/ads_globals.h +++ b/src/ads_globals.h @@ -132,7 +132,7 @@ enum eBitwiseOperator /** - * Each dock container supports 4 sidbars + * Each dock container supports 4 sidebars */ enum SideBarLocation { From bfad80c54021029e08e9cc1b3c327a025bc9ee41 Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Tue, 1 Nov 2022 13:41:36 +0100 Subject: [PATCH 22/22] Some code cleanup --- src/AutoHideDockContainer.cpp | 6 +++--- src/AutoHideSideBar.cpp | 10 +++++----- src/AutoHideSideBar.h | 2 +- src/AutoHideTab.cpp | 12 ++++++------ src/AutoHideTab.h | 10 +++++----- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/AutoHideDockContainer.cpp b/src/AutoHideDockContainer.cpp index 7cb2ee1..6256b78 100644 --- a/src/AutoHideDockContainer.cpp +++ b/src/AutoHideDockContainer.cpp @@ -18,7 +18,7 @@ //============================================================================ -/// \file AutoHideDockContainer.h +/// \file AutoHideDockContainer.cpp /// \author Syarif Fakhri /// \date 05.09.2022 /// \brief Implementation of CAutoHideDockContainer class @@ -27,8 +27,6 @@ //============================================================================ // INCLUDES //============================================================================ -#include -#include #include "AutoHideDockContainer.h" #include @@ -44,6 +42,8 @@ #include "DockingStateReader.h" #include "ResizeHandle.h" #include "DockComponentsFactory.h" +#include "AutoHideSideBar.h" +#include "AutoHideTab.h" #include diff --git a/src/AutoHideSideBar.cpp b/src/AutoHideSideBar.cpp index e384624..9fd7709 100644 --- a/src/AutoHideSideBar.cpp +++ b/src/AutoHideSideBar.cpp @@ -18,19 +18,18 @@ //============================================================================ -/// \file DockWidgetTab.h +/// \file AutoHideSideBar.cpp /// \author Syarif Fakhri /// \date 05.09.2022 -/// \brief Implementation of CSideTabBar class +/// \brief Implementation of CAutoHideSideBar class //============================================================================ - //============================================================================ // INCLUDES //============================================================================ -#include -#include +#include "AutoHideSideBar.h" + #include #include #include @@ -42,6 +41,7 @@ #include "AutoHideDockContainer.h" #include "DockAreaWidget.h" #include "DockingStateReader.h" +#include "AutoHideTab.h" namespace ads { diff --git a/src/AutoHideSideBar.h b/src/AutoHideSideBar.h index 385bd38..11f7345 100644 --- a/src/AutoHideSideBar.h +++ b/src/AutoHideSideBar.h @@ -20,7 +20,7 @@ //============================================================================ -/// \file DockWidgetTab.h +/// \file AutoHideSideBar.h /// \author Syarif Fakhri /// \date 05.09.2022 /// \brief Declaration of CAutoHideSideBar class diff --git a/src/AutoHideTab.cpp b/src/AutoHideTab.cpp index 4b901ef..b0b4471 100644 --- a/src/AutoHideTab.cpp +++ b/src/AutoHideTab.cpp @@ -18,23 +18,23 @@ //============================================================================ -/// \file DockWidgetTab.h +/// \file AutoHideTab.cpp /// \author Syarif Fakhri /// \date 05.09.2022 -/// \brief Implementation of CDockWidgetSideTab class +/// \brief Implementation of CAutoHideTab class //============================================================================ //============================================================================ // INCLUDES //============================================================================ -#include -#include -#include +#include "AutoHideTab.h" + #include +#include "AutoHideDockContainer.h" +#include "AutoHideSideBar.h" #include "DockAreaWidget.h" #include "DockManager.h" - #include "DockWidget.h" namespace ads diff --git a/src/AutoHideTab.h b/src/AutoHideTab.h index ba20bad..d3783b9 100644 --- a/src/AutoHideTab.h +++ b/src/AutoHideTab.h @@ -1,5 +1,5 @@ -#ifndef DockWidgetSideTabH -#define DockWidgetSideTabH +#ifndef AutoHideTabH +#define AutoHideTabH /******************************************************************************* ** Qt Advanced Docking System ** Copyright (C) 2017 Uwe Kindler @@ -20,10 +20,10 @@ //============================================================================ -/// \file DockWidgetTab.h +/// \file AutoHideTab.h /// \author Syarif Fakhri /// \date 05.09.2022 -/// \brief Declaration of CDockWidgetSideTab class +/// \brief Declaration of CAutoHideTab class //============================================================================ //============================================================================ @@ -118,7 +118,7 @@ public: * Sets the dock widget that is controlled by this tab */ void setDockWidget(CDockWidget* DockWidget); -}; // class DockWidgetSideTab +}; // class AutoHideTab } // namespace ads //-----------------------------------------------------------------------------