Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.15.17, 6.7.2
-
None
Description
When using a QConcatenateTablesProxyModel (QCTPM) as source of a QSortFilterProxyModel (QSFPM) with sorting enabled, the sorting breaks when temporarily removing all source models from the QCTPM and then adding them again.
That seems to be because the QCTPM also sets the columnCount to 0 in empty state, which confuses the QSFPM in its sortColumn handling. The QSFPM has lots of guards checking whether update_source_sort_column() actually updates the sort column, and I think this code doesn't cause a resort when the rows are added while the column count is still 0.
I attach an example demonstrating the issue, both with QCTPM, and also with a simpler test model that does the column removal on clear().
Note that in the more minimal example, the sorting works if the column is restored /before/ the rows are added, so changing the order in QCTPM might fix this, but QSFPM should probably be able to handle both cases. (if adding data while column count is 0 is a valid model state)