Bug 514121 - Preserve item selection when resorting columns in Table View (Album tab)
Summary: Preserve item selection when resorting columns in Table View (Album tab)
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Albums-TableView (other bugs)
Version First Reported In: 9.0.0
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: anamaynarkar
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-01-03 19:29 UTC by zroutik
Modified: 2026-03-19 01:54 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 9.1.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description zroutik 2026-01-03 19:29:34 UTC
SUMMARY
Table View in Album tab does not preserve item selection when resorting columns, which prevents practical comparison workflows (e.g. cross-checking duplicate filenames across multiple file types).

STEPS TO REPRODUCE
1. Open an album in the Album tab and switch to Table View.
2. Sort items by the "Type" column (e.g. JPEG, TIFF, PNG).
3. Select multiple items (for example, all JPEG files).
4. Click another column header, such as "Filename", to resort the table.

OBSERVED RESULT
The current selection is cleared when the table is resorted by another column. Previously selected items are no longer selected.

EXPECTED RESULT
The selection should be preserved across column resorting. After sorting by a different column, the same items (identified by their internal IDs / file paths) should remain selected, even if their visual order changes.

This would allow workflows such as:
- Sorting by Type, selecting one or more file types,
- Then sorting by Filename to visually check for duplicate or corresponding files (e.g. JPEG/TIFF triples) while keeping the selection intact.

SOFTWARE/OS VERSIONS
Windows: —
macOS: —
(available in the Info Center app, or by running `kinfo` in a terminal window)
Linux/KDE Plasma: —
KDE Plasma Version: —
KDE Frameworks Version: —
Qt Version: —

ADDITIONAL INFORMATION
This appears to be a UX limitation rather than a crash or data-loss bug. Preserving selection across sorting is common behavior in table views and would significantly improve usability for managing large, mixed-format photo collections.
Comment 1 caulier.gilles 2026-01-04 06:46:15 UTC
I confirm the table view selection lost at column sort change under macOS
Comment 2 caulier.gilles 2026-03-19 01:54:53 UTC
Git commit 24e1beccbc041da773da0f0f197308968e98a812 by Gilles Caulier, on behalf of Anamay Narkar.
Committed on 18/03/2026 at 21:19.
Pushed by cgilles into branch 'master'.

Bug: 514121: TableView: preserve selection when resorting columns

When sorting by a column header, TableViewModel::sort() calls
beginResetModel which causes the selection state to be reset.

Fix by connecting to modelAboutToBeReset and saving the selected
image Ids before the clear occurs. The restore is deferred by one
tick to allow image model to finish resetting before looking
up new row positions by Id.

M  +110  -2    core/app/views/tableview/tableview_selection_model_syncer.cpp
M  +3    -1    core/app/views/tableview/tableview_selection_model_syncer.h

https://invent.kde.org/graphics/digikam/-/commit/24e1beccbc041da773da0f0f197308968e98a812