Automatically expand treeview items when searching.

This commit is contained in:
craig
2012-03-27 17:39:05 +00:00
parent a6c4c6b67a
commit 3fe8b94b59
17 changed files with 108 additions and 16 deletions

View File

@@ -85,3 +85,22 @@ QModelIndexList TreeView::selectedIndexes() const
}
return sort.values();
}
void TreeView::expandAll()
{
quint32 count=model()->rowCount();
for (quint32 i=0; i<count; ++i) {
expand(model()->index(i, 0));
}
}
void TreeView::expand(const QModelIndex &idx)
{
if (idx.isValid()) {
setExpanded(idx, true);
quint32 count=model()->rowCount(idx);
for (quint32 i=0; i<count; ++i) {
expand(idx.child(i, 0));
}
}
}