diff options
| author | Pan Zhang <[email protected]> | 2026-04-02 20:08:43 +0800 |
|---|---|---|
| committer | Méven Car <[email protected]> | 2026-04-02 14:17:27 +0000 |
| commit | 0d10eff3726e5de60298452308cc4b2b7820e10b (patch) | |
| tree | 27c822ab083ecc2bafee1552b45648ae470cfaf1 /src/kitemviews/private/kitemlistroleeditor.cpp | |
| parent | 6e48c057b9595427ee0a5c245c7c98b2817ff2ab (diff) | |
kfileitemmodel: sort dotted numeric names naturally
Natural sorting already handled plain numeric chunks, but names containing dots between numeric segments were still ordered lexically in important cases. This broke expected ordering for decimal-style names like 0.09 and 0.1, and for version-like names such as v1.2.3 and v1.2.10.
Teach KFileItemModel's natural string comparison to recognize dotted numeric chains instead of relying solely on QCollator's numeric mode. Compare two-part numeric chains (e.g. 0.09 vs 0.1) as decimal values, and compare longer chains segment by segment like version numbers, while still treating real file extensions separately so names like 1.09.txt keep working correctly.
Add a direct unit test for KFileItemModel::stringCompare covering decimal-style names, version-like dotted numeric names, numeric basenames with extensions, leading-dot names, and the non-natural sorting fallback.
BUG: 411707
Diffstat (limited to 'src/kitemviews/private/kitemlistroleeditor.cpp')
0 files changed, 0 insertions, 0 deletions
