Regression: pitches in Edit Drumset not sorted in numeric order
In #177646, I suggested more fitting column widths in the "Edit drumset“ dialogue. In the change that fixed the issue the ability to sort columns was also introduced. (60e55b2704 )
There is an issue with sorting columns, however: If one orders by "No", ordering happens like this: "0, 10, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 11" instead of "0, 1, 2, 3, 4, 5, …“ I'm sure that is not intended.
Comments
Looks like the program is written to sort alphabetically rather than numerically.
The problem seems to be that there is no property in Qt that would be able to influence the sorting algorithm, other than whether to sort descending or ascending.
See http://doc.qt.io/qt-5/qt.html#SortOrder-enum
It does indeed sort in alapethical order.
One thing that might work is to add leading zeroes, so we have 3-digit numbers all the way, but that'd look rather ugly.
This also isn't really a regression, as before sorting wasn't possible at all.
We could disable the sorting entirely though
If I remember correctly adding zeros at the beginning will put all of the numbers starting with 0 after the numbers starting with 1-9, that would be worse.
I don't use this option much, but I would prefer no sort to a bad sort. i don't know what qt has as far as capabilities, but does it include a return to default or default display you could call if the user selects sort by number?
I agree that no sort is better than a bad sort.
@mike320: I'm pretty sure you're remembering incorrectly, 0 is smaller than 1, numerically and alphabethically (0 is ASCII 48, 1 is 49), so with leading 0 the sorting would be correct. But look ugly.
Also apparently is it not possible to set which columns can get sorted and which down, it seems either all or none. The code sorts the last column by default, and descending, Z-A
See https://github.com/musescore/MuseScore/pull/3130, which reverts the sorting part of #177646: More appropriate column widths in "Edit drumset" dialogue
Hah! I found a better fix, add leading spaces (space, ASCII 32, is still smaler than '0'), got the sorting to work! PR updated.
Meanwhile lasconic did a PR too, se https://github.com/musescore/MuseScore/pull/3133
Fixed in branch 2.1, commit 62fae827fc
fix #186386: pitches in Edit Drumset not sorted in numeric order
Fixed in branch 2.1, commit 899f823cba
Merge pull request #3133 from lasconic/fix-186386
fix #186386: pitches in Edit Drumset not sorted in numeric order
Fixed in branch master, commit 2b39771b34
fix #186386: pitches in Edit Drumset not sorted in numeric order
Automatically closed -- issue fixed for 2 weeks with no activity.