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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.11.3
    • Fix Version/s: None
    • Component/s: Core: Item Models
    • Labels:
      None
    • Environment:
      Linux Debian
    • Platform/s:
      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

            Assignee:
            dfaure_kdab David Faure
            Reporter:
            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