1
0
mirror of https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git synced 2025-04-01 02:42:39 +08:00

Add flag to DockWidget to force dw to be closed with the area that contains it

This commit is contained in:
Nicolas ELIE 2020-08-04 11:41:20 +02:00
parent edc799bc54
commit 40636d1e05
3 changed files with 12 additions and 7 deletions

View File

@ -32,6 +32,7 @@ public:
DockWidgetDeleteOnClose, DockWidgetDeleteOnClose,
CustomCloseHandling, CustomCloseHandling,
DockWidgetFocusable, DockWidgetFocusable,
DockWidgetForceCloseWithArea,
DefaultDockWidgetFeatures, DefaultDockWidgetFeatures,
AllDockWidgetFeatures, AllDockWidgetFeatures,
NoDockWidgetFeatures NoDockWidgetFeatures

View File

@ -893,6 +893,9 @@ void CDockAreaWidget::closeArea()
{ {
for (auto DockWidget : openedDockWidgets()) for (auto DockWidget : openedDockWidgets())
{ {
if (DockWidget->features().testFlag(CDockWidget::DockWidgetDeleteOnClose) && DockWidget->features().testFlag(CDockWidget::DockWidgetForceCloseWithArea))
DockWidget->closeDockWidgetInternal();
else
DockWidget->toggleView(false); DockWidget->toggleView(false);
} }
} }

View File

@ -153,6 +153,7 @@ public:
DockWidgetDeleteOnClose = 0x08, ///< deletes the dock widget when it is closed DockWidgetDeleteOnClose = 0x08, ///< deletes the dock widget when it is closed
CustomCloseHandling = 0x10, CustomCloseHandling = 0x10,
DockWidgetFocusable = 0x20, DockWidgetFocusable = 0x20,
DockWidgetForceCloseWithArea = 0x40,
DefaultDockWidgetFeatures = DockWidgetClosable | DockWidgetMovable | DockWidgetFloatable | DockWidgetFocusable, DefaultDockWidgetFeatures = DockWidgetClosable | DockWidgetMovable | DockWidgetFloatable | DockWidgetFocusable,
AllDockWidgetFeatures = DefaultDockWidgetFeatures | DockWidgetDeleteOnClose | CustomCloseHandling, AllDockWidgetFeatures = DefaultDockWidgetFeatures | DockWidgetDeleteOnClose | CustomCloseHandling,
NoDockWidgetFeatures = 0x00 NoDockWidgetFeatures = 0x00