Skip to content

Commit 5e230d8

Browse files
Closing a dock area with only one single dock widget that has the DockWidgetDeleteOnCloseFeature will delete the dock widget and the area now
1 parent a45a035 commit 5e230d8

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/DockAreaWidget.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -799,9 +799,19 @@ QAbstractButton* CDockAreaWidget::titleBarButton(TitleBarButton which) const
799799
//============================================================================
800800
void CDockAreaWidget::closeArea()
801801
{
802-
for (auto DockWidget : openedDockWidgets())
802+
// If there is only one single dock widget and this widget has the
803+
// DeleteOnClose feature, then we delete the dock widget now
804+
auto OpenDockWidgets = openedDockWidgets();
805+
if (OpenDockWidgets.count() == 1 && OpenDockWidgets[0]->features().testFlag(CDockWidget::DockWidgetDeleteOnClose))
806+
{
807+
OpenDockWidgets[0]->deleteDockWidget();
808+
}
809+
else
803810
{
804-
DockWidget->toggleView(false);
811+
for (auto DockWidget : openedDockWidgets())
812+
{
813+
DockWidget->toggleView(false);
814+
}
805815
}
806816
}
807817

0 commit comments

Comments
 (0)