Fixed some issues with custom close handling

This commit is contained in:
Uwe Kindler 2020-01-14 12:43:42 +01:00
parent 9af9e43a5d
commit 407af06a4a
3 changed files with 16 additions and 7 deletions

View File

@ -1726,7 +1726,6 @@ void CDockContainerWidget::closeOtherAreas(CDockAreaWidget* KeepOpenArea)
// We do not close areas with widgets with custom close handling
if (DockArea->features(BitwiseOr).testFlag(CDockWidget::CustomCloseHandling))
{
std::cout << "CDockWidget::CustomCloseHandling" << std::endl;
continue;
}

View File

@ -770,6 +770,21 @@ bool CDockWidget::closeDockWidgetInternal(bool ForceClose)
if (features().testFlag(CDockWidget::DockWidgetDeleteOnClose))
{
// If the dock widget is floating, then we check if we also need to
// delete the floating widget
if (isFloating())
{
CFloatingDockContainer* FloatingWidget = internal::findParent<
CFloatingDockContainer*>(this);
if (FloatingWidget->dockWidgets().count() == 1)
{
FloatingWidget->deleteLater();
}
else
{
FloatingWidget->hide();
}
}
deleteDockWidget();
}
else

View File

@ -361,13 +361,8 @@ void CFloatingDockContainer::closeEvent(QCloseEvent *event)
auto TopLevelDockWidget = topLevelDockWidget();
if (TopLevelDockWidget && TopLevelDockWidget->features().testFlag(CDockWidget::DockWidgetDeleteOnClose))
{
if (TopLevelDockWidget->closeDockWidgetInternal())
if (!TopLevelDockWidget->closeDockWidgetInternal())
{
this->deleteLater();
}
else
{
event->ignore();
return;
}
}