Project Tree: Add functionality to expand a single node recursively

From time to time, I find myself wanting to fully expand
a specific sub-tree.

Change-Id: Ie49b76a7a7a6fae3684bbdfb5735638bbc41b301
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2020-02-18 18:03:22 +01:00
parent 04f933fd67
commit 5451b78367
5 changed files with 43 additions and 3 deletions

View File

@@ -432,6 +432,20 @@ void ProjectTreeWidget::setAutoSynchronization(bool sync)
syncFromDocumentManager();
}
void ProjectTreeWidget::expandNodeRecursively(const QModelIndex &index)
{
const int rc = index.model()->rowCount(index);
for (int i = 0; i < rc; ++i)
expandNodeRecursively(index.model()->index(i, index.column(), index));
if (rc > 0)
m_view->expand(index);
}
void ProjectTreeWidget::expandCurrentNodeRecursively()
{
expandNodeRecursively(m_view->currentIndex());
}
void ProjectTreeWidget::collapseAll()
{
m_view->collapseAll();