1
0
mirror of https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git synced 2025-03-25 23:42:39 +08:00

Fix nasty and still unclear bug with "Close Other" not closing all tabs in certain conditions. (#725)

This commit is contained in:
Federico Fuga 2025-03-17 10:38:10 +01:00 committed by GitHub
parent 936eba01cd
commit df1fa27127
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -334,27 +334,13 @@ void CDockAreaTabBar::onTabCloseRequested()
void CDockAreaTabBar::onCloseOtherTabsRequested()
{
auto Sender = qobject_cast<CDockWidgetTab*>(sender());
for (int i = 0; i < count(); ++i)
{
auto Tab = tab(i);
if (Tab->isClosable() && !Tab->isHidden() && Tab != Sender)
{
// If the dock widget is deleted with the closeTab() call, its tab
// it will no longer be in the layout, and thus the index needs to
// be updated to not skip any tabs
int Offset = Tab->dockWidget()->features().testFlag(
CDockWidget::DockWidgetDeleteOnClose) ? 1 : 0;
closeTab(i);
// If the dock widget blocks closing, i.e. if the flag
// CustomCloseHandling is set, and the dock widget is still open,
// then we do not need to correct the index
if (Tab->dockWidget()->isClosed())
{
i -= Offset;
}
}
}
for (int i = count() - 1; i >= 0; --i) {
auto Tab = tab(i);
if (Tab->isClosable() && !Tab->isHidden() && Tab != Sender) {
closeTab(i);
}
}
}