Removed code for disabling close button because this caused trouble, fixed updating of window title if dock area is removed

This commit is contained in:
Uwe Kindler 2018-10-30 14:30:02 +01:00
parent 927be9a7d9
commit 81523b0346
3 changed files with 11 additions and 27 deletions

View File

@ -57,6 +57,7 @@
#include "DockManager.h" #include "DockManager.h"
#include "DockWidget.h" #include "DockWidget.h"
#include "DockAreaWidget.h" #include "DockAreaWidget.h"
#include "AnimatedLabel.h"
//============================================================================ //============================================================================
@ -281,6 +282,8 @@ CMainWindow::CMainWindow(QWidget *parent) :
d->restoreState(); d->restoreState();
d->restorePerspectives(); d->restorePerspectives();
/*CAnimatedLabel* AnimatedLabel = new CAnimatedLabel();
AnimatedLabel->show();*/
} }

View File

@ -9,15 +9,19 @@ CONFIG *= c++14
SOURCES += \ SOURCES += \
main.cpp \ main.cpp \
MainWindow.cpp MainWindow.cpp \
AnimatedLabel.cpp
HEADERS += \ HEADERS += \
MainWindow.h MainWindow.h \
AnimatedLabel.h
FORMS += \ FORMS += \
mainwindow.ui mainwindow.ui
RESOURCES += main.qrc
LIBS += -L$${ADS_OUT_ROOT}/lib LIBS += -L$${ADS_OUT_ROOT}/lib
# Dependency: AdvancedDockingSystem (shared) # Dependency: AdvancedDockingSystem (shared)

View File

@ -91,17 +91,6 @@ struct FloatingDockContainerPrivate
{ {
DraggingState = StateId; 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 // struct FloatingDockContainerPrivate
@ -261,10 +250,6 @@ CFloatingDockContainer::CFloatingDockContainer(CDockAreaWidget* DockArea) :
CFloatingDockContainer(DockArea->dockManager()) CFloatingDockContainer(DockArea->dockManager())
{ {
d->DockContainer->addDockArea(DockArea); d->DockContainer->addDockArea(DockArea);
if (!DockArea->features().testFlag(CDockWidget::DockWidgetClosable))
{
d->disableCloseButton();
}
} }
@ -273,10 +258,6 @@ CFloatingDockContainer::CFloatingDockContainer(CDockWidget* DockWidget) :
CFloatingDockContainer(DockWidget->dockManager()) CFloatingDockContainer(DockWidget->dockManager())
{ {
d->DockContainer->addDockWidget(CenterDockWidgetArea, DockWidget); d->DockContainer->addDockWidget(CenterDockWidgetArea, DockWidget);
if (!DockWidget->features().testFlag(CDockWidget::DockWidgetClosable))
{
d->disableCloseButton();
}
} }
//============================================================================ //============================================================================
@ -499,9 +480,9 @@ bool CFloatingDockContainer::isClosable() const
void CFloatingDockContainer::onDockAreasAddedOrRemoved() void CFloatingDockContainer::onDockAreasAddedOrRemoved()
{ {
qDebug() << "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()); this->setWindowTitle(d->SingleDockArea->currentDockWidget()->windowTitle());
connect(d->SingleDockArea, SIGNAL(currentChanged(int)), this, connect(d->SingleDockArea, SIGNAL(currentChanged(int)), this,
SLOT(onDockAreaCurrentChanged(int))); SLOT(onDockAreaCurrentChanged(int)));
@ -534,10 +515,6 @@ bool CFloatingDockContainer::restoreState(QXmlStreamReader& Stream, bool Testing
{ {
return false; return false;
} }
if (!d->DockContainer->features().testFlag(CDockWidget::DockWidgetClosable))
{
d->disableCloseButton();
}
onDockAreasAddedOrRemoved(); onDockAreasAddedOrRemoved();
return true; return true;
} }