-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Visual sort indicators for multi-column sorting #1810
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This adds visual sort indicators to the already working multi-column sorting. Qt sort indicator is disabled, so only one indicator per column is visible. Unicode characters are used to indicate direction (triangles) and sort column order (superscript numbers). See issue #1761
Just tried this out, and it's already a definite win. 😄 One thing that I'm not sure about, is if clicking an already selected column header should reverse that column? For example, using the pitchfork database, and filtering the results to just "Massive Attack", I've selected three sort columns: It "felt natural" to then click on the 2nd column again, expecting the sort on that column to be reversed. But no change to it's ordering occurred. Does that make sense? 😄 |
Building with this on Win64 (using MSVC 2017) is failing:
Looks like it's unhappy with the |
Guessing here, but maybe the first argument (eg |
Yep, with that concept patch (04ebb39), it's compiling with MSVC2017 too. It's probably not exactly the correct regex to use, as it only changes the last digit in the field. So, double digit (10, 11, 50 😉) sort indicators wouldn't work. Feel free to ignore, use it, etc as desired. 😄 @mtissington This is a Win64 build with multi-column sorting + the new sort indicators added: https://nightlies.sqlitebrowser.org/win64-onceoffs/DB.Browser.for.SQLite-pr1810v1-win64.msi Wanna try it out? 😄 |
Oh, yes, this is very good - love the icon too - 😄 |
In fact, it shouldn't be a regexp but a simple character substitution. The problem seems to be in using Unicode character literals. Maybe they aren't supported by MSVC, but your patch suggests that they Unicode character is working inside the string literals, so I've made a new commit for using strings instead of characters and I hope it's working in MSVC too. Could you make a compilation test?
Yes, I think it should change direction too. This is part of the logic whose credit must go to Martin. I only made the visual part and opened this PR so I don't conflict with any possible pending work he might have. @MKleusberg are you still working on this? In #1761 (comment) @karim describes the way how the multiple clicks on an already added column should behave. In summary, it should be left in the same position and change the ascending or descending direction. Currently it is adding the column again to the sort part of the query, so it only works well when the column you click again is the last added one. I don't know how difficult it would be to change it to behave as Karim says, but it would be ideal. |
Done. Yep, that worked. MSVC 2017 had no issues this time. 😄 |
Probably a silly question... er... what icon? 😉 |
@justinclift sort indicators 👍 |
This looks very good 👍 The only very minor thing I am unsure about is whether to show the little 1 even if there is only one sorting column - as in "if there is a 1 there must be a 2 somewhere too" 😉 Any opinions? But as I said, that seems like a very minor point to me 😄 |
With a single column selected it doesn't really matter. Though I'd probably show the "1" anyway, just because it will probably hint to our existing users that something has changed and they can click more columns now. eg "subtle feature education" or something. 😁 |
i agree, it gives a needed hint. |
I considered leaving the original sort indicator when only one column is selected, but finally went for the homogeneity of always showing the numbers and one of the reasons is that said, about letting the user know that they can select more than one. Shall we merge this now, then? |
Yep, merged. 😄 Kind of thinking the multi-column selection + this to visually show it will be one of the Highlights from the next major (3.12.0) release. Well done! 😄 |
A second Ctrl+Click over an already added column changes the direction of any column. Before this change, the effect was only applied to the last selected column and a second Ctrl+Click on the other columns triggered a requery without having changed anything. This was mentioned in PR #1810. See also issue #1761.
headerData() now returns column name plus sort indicator in the display role and only the column name in the edit role. This allows to use the edit role for the plot and the copy-with-headers features, so they do not show the sort indicator as part of the column name. See related issue #1409 and PR #1810
This adds visual sort indicators to the already working multi-column
sorting. Qt sort indicator is disabled, so only one indicator per column
is visible.
Unicode characters are used to indicate direction (triangles) and sort
column order (superscript numbers).
See issue #1761