diff --git a/src/frontends/qt/TocWidget.cpp b/src/frontends/qt/TocWidget.cpp index 0770cf3ab9..da6d4f3b49 100644 --- a/src/frontends/qt/TocWidget.cpp +++ b/src/frontends/qt/TocWidget.cpp @@ -637,12 +637,9 @@ void TocWidget::collapseAllOthers(int const depth) for (int i = size - 1; i >= 0; i--) { QModelIndex index = indices[i]; if (tocTV->isExpanded(index) - && !isAncestor(index, tocTV->currentIndex())) { - if (depth < getItemDepth(index)) - tocTV->collapse(index); - if (depth > 0 && index.parent() == QModelIndex()) - tocTV->expandRecursively(index, depth - 1); - } + && !isAncestor(index, tocTV->currentIndex()) + && depth < getItemDepth(index)) + tocTV->collapse(index); } }