Skip to content

Commit

Permalink
Fixed some issues with custom close handling
Browse files Browse the repository at this point in the history
  • Loading branch information
githubuser0xFFFF committed Jan 14, 2020
1 parent 9af9e43 commit 407af06
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
1 change: 0 additions & 1 deletion src/DockContainerWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
15 changes: 15 additions & 0 deletions src/DockWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 1 addition & 6 deletions src/FloatingDockContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 407af06

Please sign in to comment.