Restore directories-first order of passwords tree view on non-Mac platforms #475
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Since commit b4dc9e6 ("Auto update CHANGELOG and sorting of treeview")
directories are no longer listed first in the tree view of passwords.
This is because a simple sort of the tree view widget (as enabled by the
aforementioned commit) does its work by sorting the backing
StoreModel (QSortFilterProxyModel), which in turn does just a simple
lexicographical order sort on the path of each its item.
Before that commit the sort was done by QFileSystemModel via
QFileSystemModelSorter, which always places its directories first on
non-Mac platforms.
Unfortunately, QFileSystemModelSorter is an internal Qt helper class, so we
can't just use it directly, we need to open-code a bit of logic from
QFileSystemModelSorter::compareNodes() into StoreModel::lessThan() to
restore the old behavior.
This PR also contains 3 small improvements around the modified code (in
separate commits).