Restore directories-first order of passwords tree view on non-Mac platforms#475
Merged
annejan merged 4 commits intoSep 23, 2019
Conversation
When we are setting the source model in StoreModel::setModelAndStore() set it also for StoreModel base class to make the extra setSourceModel() call unnecessary.
…tforms 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.
1 similar comment
Codecov Report
@@ Coverage Diff @@
## master #475 +/- ##
========================================
- Coverage 7.32% 7.3% -0.03%
========================================
Files 44 44
Lines 2798 2806 +8
========================================
Hits 205 205
- Misses 2593 2601 +8
Continue to review full report at Codecov.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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).