Bug 507749

Summary: Sort Items by Name in Thumbnails View
Product: [Applications] digikam Reporter: jbrauher
Component: Thumbs-ImageAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles, metzpinguin
Priority: NOR    
Version First Reported In: 8.8.0   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed/Implemented In: 8.8.0
Sentry Crash Report:

Description jbrauher 2025-08-01 15:27:47 UTC
***
While viewing thumbnails of images in a folder, I have selected to sort items by Name in Ascending order.  If I have the following 3 files: "Test.jpg", "Test_a.jpg", and "Test_b.jpg", they sort in the following way within the album/folder in Windows, the Windows Command Line, and I believe Linux:

Test.jpg
Test_a.jpg
Test_b.jpg

However, in the Thumbnail viewer of the album/folder containing these 3 images, Digikam displays them in the following order:

Test_a.jpg
Test_b.jpg
Test.jpg

when sorted by Name in Ascending order.

I have not been able to change the settings such that the files would sort into the same order that the operating systems display them (and the order I would like to run them through renaming/Queque manager).  

As a separate test, I opened the folder in another tool, XNView MP and it sorted in the same order that the operating systems display the images which is what I expected Digikam to also do. 

***

SUMMARY
Sort order of images by Name in Ascending or Descending order - logic

STEPS TO REPRODUCE
1. Open an Album / folder and view Thumbnails
2. Select Sort by Name in Ascending order

OBSERVED RESULT
Test_a.jpg
Test_b.jpg
Test.jpg

EXPECTED RESULT
Test.jpg
Test_a.jpg
Test_b.jpg

SOFTWARE/OS VERSIONS
Windows: 11
Comment 1 caulier.gilles 2025-08-01 16:27:59 UTC
Switch the icon-view to the table-view in digiKam and look if the problem still reproducible...

https://docs.digikam.org/en/main_window/image_view.html#general-information
Comment 2 Maik Qualmann 2025-08-01 16:34:31 UTC
We just had this yesterday, read this bug for the solution: Bug 507713

Maik
Comment 3 jbrauher 2025-08-01 17:15:47 UTC
I switched to Table View and the images now sort in the following order (which appear to be in descending order):

Test_b.jpg
Test_a.jpg
Test.jpg

when I have selected "By Name" and "Ascending Order" under the View sorting order selections.

So, it looks like the sort is different from Thumbnail to Table view and neither match to the pre-selection of By Name, Ascending Order
Comment 4 caulier.gilles 2025-08-01 17:44:03 UTC
As Maik said, look at https://bugs.kde.org/show_bug.cgi?id=507713
Comment 5 Maik Qualmann 2025-08-01 18:13:54 UTC
However, switching to "normal" string comparison loses the numeric sorting. For years, Dolphin sorted in the same way as digiKam. Now, it doesn't. I found the corresponding commit; the cause is apparently the filename extension in QCollator. I'll take a closer look.

Maik
Comment 6 Maik Qualmann 2025-08-01 19:29:38 UTC
Git commit 8763113ff983fc9ac85f53310bdb78bf3d7f55a8 by Maik Qualmann.
Committed on 01/08/2025 at 19:28.
Pushed by mqualmann into branch 'master'.

fix natural item sorting with QCollator
Related: bug 507713
FIXED-IN: 8.8.0

M  +2    -2    NEWS
M  +25   -9    core/libs/database/models/itemsortcollator.cpp

https://invent.kde.org/graphics/digikam/-/commit/8763113ff983fc9ac85f53310bdb78bf3d7f55a8