Skip to content

Fix sorting by file size in IssuesWidget - #1160

Merged
fracturehill merged 1 commit into
mainfrom
work/syncerrorsorting
Oct 9, 2026
Merged

fracturehill merged 1 commit into
mainfrom
work/syncerrorsorting

Conversation

@fracturehill

Copy link
Copy Markdown
Contributor

Previously, sorting of the size column was based on the already formatted, human-readable size string, which is inappropriate to use for sorting and will return wrong (and locale-dependent) results.

This commit adds a new Models::SortRole, which ensures the size is provided as an int for sorting purposes. For items where the size field is not relevant, the role returns -1, so that they can be sorted before everything else. For all other columns, SortRole falls back to what Qt:DisplayRole would return.

Fixes #793

@TheOneRing TheOneRing left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, tiny nitpick

Comment thread src/gui/models/protocolitemmodel.cpp Resolved
@fracturehill
fracturehill force-pushed the work/syncerrorsorting branch from b736105 to 0807d23 Compare October 8, 2026 13:27
Previously, sorting of the size column was based on the
already formatted, human-readable size string, which is
inappropriate to use for sorting and will return wrong
(and locale-dependent) results.

This commit adds a new Models::SortRole, which ensures the
size is provided as an int for sorting purposes. For items
where the size field is not relevant, the role returns -1,
so that they can be sorted before everything else. For all
other columns, SortRole falls back to what Qt:DisplayRole
would return.
@fracturehill
fracturehill force-pushed the work/syncerrorsorting branch from 0807d23 to f6c949d Compare October 8, 2026 13:42
@fracturehill
fracturehill merged commit fb48f57 into main Oct 9, 2026
@fracturehill
fracturehill deleted the work/syncerrorsorting branch October 9, 2026 07:13
@openclouders openclouders mentioned this pull request Oct 9, 2026
1 task
@saw-jan saw-jan mentioned this pull request Nov 25, 2026
9 of 22 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows Client: Sort by size incorrect

2 participants