Closing a dock area with only one single dock widget that has the DockWidgetDeleteOnCloseFeature will delete the dock widget and the area now

This commit is contained in:
Uwe Kindler 2019-12-11 16:06:07 +01:00
parent a45a035bb3
commit 5e230d8874

View File

@ -799,10 +799,20 @@ QAbstractButton* CDockAreaWidget::titleBarButton(TitleBarButton which) const
//============================================================================
void CDockAreaWidget::closeArea()
{
// If there is only one single dock widget and this widget has the
// DeleteOnClose feature, then we delete the dock widget now
auto OpenDockWidgets = openedDockWidgets();
if (OpenDockWidgets.count() == 1 && OpenDockWidgets[0]->features().testFlag(CDockWidget::DockWidgetDeleteOnClose))
{
OpenDockWidgets[0]->deleteDockWidget();
}
else
{
for (auto DockWidget : openedDockWidgets())
{
DockWidget->toggleView(false);
}
}
}