forked from qt-creator/qt-creator
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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user