Skip to content

Commit 81523b0

Browse files
author
Uwe Kindler
committed
Removed code for disabling close button because this caused trouble, fixed updating of window title if dock area is removed
1 parent 927be9a commit 81523b0

File tree

3 files changed

+11
-27
lines changed

3 files changed

+11
-27
lines changed

demo/MainWindow.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
#include "DockManager.h"
5858
#include "DockWidget.h"
5959
#include "DockAreaWidget.h"
60+
#include "AnimatedLabel.h"
6061

6162

6263
//============================================================================
@@ -281,6 +282,8 @@ CMainWindow::CMainWindow(QWidget *parent) :
281282

282283
d->restoreState();
283284
d->restorePerspectives();
285+
/*CAnimatedLabel* AnimatedLabel = new CAnimatedLabel();
286+
AnimatedLabel->show();*/
284287
}
285288

286289

demo/demo.pro

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,18 @@ CONFIG *= c++14
99

1010
SOURCES += \
1111
main.cpp \
12-
MainWindow.cpp
12+
MainWindow.cpp \
13+
AnimatedLabel.cpp
1314

1415

1516
HEADERS += \
16-
MainWindow.h
17+
MainWindow.h \
18+
AnimatedLabel.h
1719

1820
FORMS += \
1921
mainwindow.ui
22+
23+
RESOURCES += main.qrc
2024

2125
LIBS += -L$${ADS_OUT_ROOT}/lib
2226

src/FloatingDockContainer.cpp

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,6 @@ struct FloatingDockContainerPrivate
9191
{
9292
DraggingState = StateId;
9393
}
94-
95-
/**
96-
* Disables the window close button if the content is not closable
97-
*/
98-
void disableCloseButton()
99-
{
100-
auto Flags = _this->windowFlags();
101-
Flags |= Qt::CustomizeWindowHint;
102-
Flags &= ~Qt::WindowCloseButtonHint;
103-
_this->setWindowFlags(Flags);
104-
}
10594
};
10695
// struct FloatingDockContainerPrivate
10796

@@ -261,10 +250,6 @@ CFloatingDockContainer::CFloatingDockContainer(CDockAreaWidget* DockArea) :
261250
CFloatingDockContainer(DockArea->dockManager())
262251
{
263252
d->DockContainer->addDockArea(DockArea);
264-
if (!DockArea->features().testFlag(CDockWidget::DockWidgetClosable))
265-
{
266-
d->disableCloseButton();
267-
}
268253
}
269254

270255

@@ -273,10 +258,6 @@ CFloatingDockContainer::CFloatingDockContainer(CDockWidget* DockWidget) :
273258
CFloatingDockContainer(DockWidget->dockManager())
274259
{
275260
d->DockContainer->addDockWidget(CenterDockWidgetArea, DockWidget);
276-
if (!DockWidget->features().testFlag(CDockWidget::DockWidgetClosable))
277-
{
278-
d->disableCloseButton();
279-
}
280261
}
281262

282263
//============================================================================
@@ -499,9 +480,9 @@ bool CFloatingDockContainer::isClosable() const
499480
void CFloatingDockContainer::onDockAreasAddedOrRemoved()
500481
{
501482
qDebug() << "CFloatingDockContainer::onDockAreasAddedOrRemoved()";
502-
if (d->DockContainer->dockAreaCount() == 1)
483+
if (d->DockContainer->visibleDockAreaCount() == 1)
503484
{
504-
d->SingleDockArea = d->DockContainer->dockArea(0);
485+
d->SingleDockArea = topLevelDockWidget()->dockAreaWidget();
505486
this->setWindowTitle(d->SingleDockArea->currentDockWidget()->windowTitle());
506487
connect(d->SingleDockArea, SIGNAL(currentChanged(int)), this,
507488
SLOT(onDockAreaCurrentChanged(int)));
@@ -534,10 +515,6 @@ bool CFloatingDockContainer::restoreState(QXmlStreamReader& Stream, bool Testing
534515
{
535516
return false;
536517
}
537-
if (!d->DockContainer->features().testFlag(CDockWidget::DockWidgetClosable))
538-
{
539-
d->disableCloseButton();
540-
}
541518
onDockAreasAddedOrRemoved();
542519
return true;
543520
}

0 commit comments

Comments
 (0)