Language list in Resource Manager sorted by size is sorted in the style of string rather than that of number

• Oct 20, 2019 - 16:44
Reported version
P3 - Low
Graphical (UI)
S4 - Minor



Title Language list in Resource Manager is sorted wrongly by sorting size Language list in Resource Manager sorted by size is sorted alphabethical rather than numerical
Frequency Few Once
Title Language list in Resource Manager sorted by size is sorted alphabethical rather than numerical Language list in Resource Manager sorted by size is sorted in the style of string rather than that of number
Frequency Few Once

~~Ah, found the cause.~~
~~languages/details.json has strings as numbers, e.g. "file_size": "86.17", while extensions/details.json has true numbers, e.g. "file_size": 85880322. So in order to fix this I need the numbers in languages/details.json to be in numerical style, rather than striated style (this is the wrong word, I know, but I don't know the adjective form of string).~~

EDIT: Wait. It probably isn't about this. I just successfully converted fileSize to a double by toString().remove(QChar('"')).toDouble() (EDIT: It isn't successful now, don't know how I did it), but the sorting is still wrong. I'm starting to think about maybe it doesn't matter what type fileSize is, because it gets converted to string once displayed on the Resource Manager. Maybe the sorting is itself bugged instead of the numbers, the sorting always treat the values as strings no matter what type we intend them to be. Maybe the extensions are sorted wrongly too, I cannot tell because there're only two (default) extensions in my MuseScore version, of which the sizes are 22 MB and 82 MB, I can't get to know how they're sorted because both sorting principles yield the same result.

If that's true, i.e. some inner working of sorting in Qt should be corrected, then I'm afraid I've no idea how to do it in the present time. I can try search-and-learn and see if I figure out something.

Status active by design

As you can see in your screenshot, you have clicked on the "File size" tab, that mean you have choose yourself the sorting.
By default this dialog show up in first place the system language, followed by the language sorted aphabetically.
I have verified for the 3.2.3, 3.3 RC, and the latest dv build.
Changing that behavior would be a real regression.

Status by design active

Being able to really sort by file size rather then the alphabethicat ordeor for those file size numbers would surely not be a regression.
The fact that this sorting does work for extentions seems to prove the point

Nobody here wants to change the default of sorting by language.

In reply to by Jojo-Schmitz

I do not agree with that, the actual behavior is perfect, each people can choose what they want, the actual behavior schow the system language first, this is perfect for people that do not want to search, typically for French people that do update language for only their own native language, for most.
Changing that would really be a regression even extensions work differently.

My vote is "do not change what is working now"

I think you're not understanding what this issue is about: you can change the sorting by clicing on the 3 different headings, to sort after those column, accending or decending. This works fine for the 1st and 2nd column, which are text, but does not for the 3rd column. So you can sort by language (the default, won't change) and by filename, but not by size.
Sorting by the rightmost 4th column doesn't work either BTW.

In reply to by Jojo-Schmitz

Extensions doesn't. The default behaviour of sorting of QTableWidget cannot be changed without creating a new class. It appears to be sorted numerically but it's actually not, it's just that there's no difference in appearance of the results of these two if the only extensions there are the two default ones.

In reply to by Jojo-Schmitz

May be I have not understanding, BTW the purpose of this dialog is to choos it s language easily.
For my own, and I think for hundreds of French people, we never sort by size, and present the system language first is a well coded design, the rest is really minor.

In reply to by Jojo-Schmitz

It seems like those who have write access to really should make the file sizes numbers, not strings. The current format is "file_size": "86.17" and every time I try to convert it into a double, the number becomes 0.0, even after I strip the quotation marks (OK, maybe the quotation marks in a JSON file aren't truly quotation marks, but I don't understand why they can be such a trouble).

We could disable sorting for 3rd and 4th column. Sorting by size is not really making much sense.
And pretending to be able to even less so.

Let's see whether @Anatoly_os is willing to change that json file on
But I understood that for the other tab, extensions, that is the case but doesn't work either?

Fixed in branch master, commit ee9b44f069

_Merge pull request #5405 from Howard-C/sort-size

fix #295895: language list in Resource Manager sorted by size is sorted in the style of string rather than that of number_

Fix version