mapeditor/tiled

Do you want to work on this issue?

You can request for a bounty in order to promote it!

Incorrect File Sorting in Project Window #4180

Sgrikkardo posted onGitHub

I've noticed an issue with the file sorting order in the Project Window. When files are named with numbers, such as "d3" and "d20", they are sorted purely alphabetically rather than numerically. As a result, "d20" appears before "d3".

  • OS: Windows 11
  • Tiled Version: 1.11.2

Not a bug, rather a missing feature. Alphabetical sorting like this is sometimes desirable, as not all groups of digits in file names represent a single number each, or even a number at all. Windows has "smart" number sorting like you proposed by default and it's tripped me up more than a few times. I prefer the current sort myself, because it works well with both numeric and non-numeric digits, provided one uses leading 0s for the numeric ones.

However, it would be nice to have an option in that panel (or in Preferences, if this can apply elsewhere as well) to allow users to sort groups of digits as numbers (OP's proposal), or sort them as characters (current).

posted by eishiya about 2 months ago

Currently I'm relying on QDir::SortFlags to do the sorting and unfortunately it does not support a numeric mode. Fortunately, Qt does provide this type of sorting through QCollator since 5.2, which we can use to implement this option after collecting the list of files (possibly relying on a sorting proxy model, to support toggling this optionafter folders have been scanned).

posted by bjorn about 2 months ago

Fund this Issue

$0.00
Funded
Only logged in users can fund an issue

Pull requests