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

Cannot change column order by subclassing QSortFilterProxyModel when there is no rows

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.11.3
    • Core: Item Models
    • None
    • Linux Debian
    • Linux/X11

    Description

      I try to change column order from my model source by subclassing QSortFilterProxyModel method mapToSource.

      It works fine except when there is no row (in source model or because they have been filtered by the QSortFilterProxyModel).

      I modify the example customsortfiltermodel to add a mapToSource methods that exchange the 2 first columns.

      You'll see it works fine at first, then the 2 columns come back to their original order when you filter all rows with date widget.

      I think it comes from the qsortfilterproxymodel headerData methods which doesn't call mapToSource method when row or column number is equal to 0.

       

       

       

      Attachments

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

        Activity

          People

            dfaure_kdab David Faure
            troopa81 Julien Cabieces
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes