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:
parent
edc799bc54
commit
40636d1e05
@ -32,6 +32,7 @@ public:
|
|||||||
DockWidgetDeleteOnClose,
|
DockWidgetDeleteOnClose,
|
||||||
CustomCloseHandling,
|
CustomCloseHandling,
|
||||||
DockWidgetFocusable,
|
DockWidgetFocusable,
|
||||||
|
DockWidgetForceCloseWithArea,
|
||||||
DefaultDockWidgetFeatures,
|
DefaultDockWidgetFeatures,
|
||||||
AllDockWidgetFeatures,
|
AllDockWidgetFeatures,
|
||||||
NoDockWidgetFeatures
|
NoDockWidgetFeatures
|
||||||
|
@ -885,17 +885,20 @@ void CDockAreaWidget::closeArea()
|
|||||||
// If there is only one single dock widget and this widget has the
|
// If there is only one single dock widget and this widget has the
|
||||||
// DeleteOnClose feature, then we delete the dock widget now
|
// DeleteOnClose feature, then we delete the dock widget now
|
||||||
auto OpenDockWidgets = openedDockWidgets();
|
auto OpenDockWidgets = openedDockWidgets();
|
||||||
if (OpenDockWidgets.count() == 1 && OpenDockWidgets[0]->features().testFlag(CDockWidget::DockWidgetDeleteOnClose))
|
if (OpenDockWidgets.count() == 1 && OpenDockWidgets[0]->features().testFlag(CDockWidget::DockWidgetDeleteOnClose))
|
||||||
{
|
{
|
||||||
OpenDockWidgets[0]->closeDockWidgetInternal();
|
OpenDockWidgets[0]->closeDockWidgetInternal();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (auto DockWidget : openedDockWidgets())
|
for (auto DockWidget : openedDockWidgets())
|
||||||
{
|
{
|
||||||
DockWidget->toggleView(false);
|
if (DockWidget->features().testFlag(CDockWidget::DockWidgetDeleteOnClose) && DockWidget->features().testFlag(CDockWidget::DockWidgetForceCloseWithArea))
|
||||||
}
|
DockWidget->closeDockWidgetInternal();
|
||||||
}
|
else
|
||||||
|
DockWidget->toggleView(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user