void MainWindow
::expandNode(const QModelIndex &parentIndex,
bool expand
) { tree->setExpanded(parentIndex, expand);
for (qint32 rowNum = 0; rowNum < treeModel->rowCount(parentIndex); ++rowNum) {
QModelIndex childIndex
= treeModel
->index
(rowNum,
0, parentIndex
);
tree->setExpanded(childIndex, expand);
expandNode(childIndex);
}
}
void MainWindow::expandNode(const QModelIndex &parentIndex, bool expand) {
tree->setExpanded(parentIndex, expand);
for (qint32 rowNum = 0; rowNum < treeModel->rowCount(parentIndex); ++rowNum) {
QModelIndex childIndex = treeModel->index(rowNum, 0, parentIndex);
tree->setExpanded(childIndex, expand);
expandNode(childIndex);
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks