Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-127380

QConcatenateTablesProxyModel behavior breaks QSortFilterProxyModel sorting

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.15.17, 6.7.2
    • Core: Item Models
    • 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)

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            dfaure_kdab David Faure
            frank.osterfeld Frank Osterfeld
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes