From 81523b0346aea4b705924896ab37bcf0973d5042 Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Tue, 30 Oct 2018 14:30:02 +0100 Subject: [PATCH] Removed code for disabling close button because this caused trouble, fixed updating of window title if dock area is removed --- demo/MainWindow.cpp | 3 +++ demo/demo.pro | 8 ++++++-- src/FloatingDockContainer.cpp | 27 ++------------------------- 3 files changed, 11 insertions(+), 27 deletions(-) diff --git a/demo/MainWindow.cpp b/demo/MainWindow.cpp index b0ee5b2..f6c0b25 100644 --- a/demo/MainWindow.cpp +++ b/demo/MainWindow.cpp @@ -57,6 +57,7 @@ #include "DockManager.h" #include "DockWidget.h" #include "DockAreaWidget.h" +#include "AnimatedLabel.h" //============================================================================ @@ -281,6 +282,8 @@ CMainWindow::CMainWindow(QWidget *parent) : d->restoreState(); d->restorePerspectives(); + /*CAnimatedLabel* AnimatedLabel = new CAnimatedLabel(); + AnimatedLabel->show();*/ } diff --git a/demo/demo.pro b/demo/demo.pro index e896870..c7a8d32 100644 --- a/demo/demo.pro +++ b/demo/demo.pro @@ -9,14 +9,18 @@ CONFIG *= c++14 SOURCES += \ main.cpp \ - MainWindow.cpp + MainWindow.cpp \ + AnimatedLabel.cpp HEADERS += \ - MainWindow.h + MainWindow.h \ + AnimatedLabel.h FORMS += \ mainwindow.ui + +RESOURCES += main.qrc LIBS += -L$${ADS_OUT_ROOT}/lib diff --git a/src/FloatingDockContainer.cpp b/src/FloatingDockContainer.cpp index 95e5536..ffebc86 100644 --- a/src/FloatingDockContainer.cpp +++ b/src/FloatingDockContainer.cpp @@ -91,17 +91,6 @@ struct FloatingDockContainerPrivate { DraggingState = StateId; } - - /** - * Disables the window close button if the content is not closable - */ - void disableCloseButton() - { - auto Flags = _this->windowFlags(); - Flags |= Qt::CustomizeWindowHint; - Flags &= ~Qt::WindowCloseButtonHint; - _this->setWindowFlags(Flags); - } }; // struct FloatingDockContainerPrivate @@ -261,10 +250,6 @@ CFloatingDockContainer::CFloatingDockContainer(CDockAreaWidget* DockArea) : CFloatingDockContainer(DockArea->dockManager()) { d->DockContainer->addDockArea(DockArea); - if (!DockArea->features().testFlag(CDockWidget::DockWidgetClosable)) - { - d->disableCloseButton(); - } } @@ -273,10 +258,6 @@ CFloatingDockContainer::CFloatingDockContainer(CDockWidget* DockWidget) : CFloatingDockContainer(DockWidget->dockManager()) { d->DockContainer->addDockWidget(CenterDockWidgetArea, DockWidget); - if (!DockWidget->features().testFlag(CDockWidget::DockWidgetClosable)) - { - d->disableCloseButton(); - } } //============================================================================ @@ -499,9 +480,9 @@ bool CFloatingDockContainer::isClosable() const void CFloatingDockContainer::onDockAreasAddedOrRemoved() { qDebug() << "CFloatingDockContainer::onDockAreasAddedOrRemoved()"; - if (d->DockContainer->dockAreaCount() == 1) + if (d->DockContainer->visibleDockAreaCount() == 1) { - d->SingleDockArea = d->DockContainer->dockArea(0); + d->SingleDockArea = topLevelDockWidget()->dockAreaWidget(); this->setWindowTitle(d->SingleDockArea->currentDockWidget()->windowTitle()); connect(d->SingleDockArea, SIGNAL(currentChanged(int)), this, SLOT(onDockAreaCurrentChanged(int))); @@ -534,10 +515,6 @@ bool CFloatingDockContainer::restoreState(QXmlStreamReader& Stream, bool Testing { return false; } - if (!d->DockContainer->features().testFlag(CDockWidget::DockWidgetClosable)) - { - d->disableCloseButton(); - } onDockAreasAddedOrRemoved(); return true; }