QTreeWidget sort problem, vs QDir::entryInfoList
-
first time, i create the QTreeWidgetItem tree base on the tree struct got from traverse the Dir using QDir::entryInfoList, and the sorting in the QTreeWidget like this:
A_dir
a_dir
A.txt
B.txt
a.txt
b.txthowever, when i change the tree data, and rebuild the QTreeWidget without traverse the Dir. and when i use sortItems(0, Qt::AscendingOrder), the sorting look like this:
A.txt
a.txt
A_dir
a_dir
B.txt
b.txtand i think the first one is much better, as it show all the Dir on the top, and then the files below.is there any way to sort QTreeWidget like this?
thank you -
ps. i ues QDir::setFilter(QDir::Dirs | QDir::Files); QDir::setSorting(QDir::DirsFirst).
that's why i got the first sorting.but how can i "simulate" this sorting when i didnot use QDir, but only use the QTreeWidget 's sorting?