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

QHeaderView: Sorting loses the hidden section when the model has no rows

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 5.9.4
    • Widgets: Itemviews
    • None

    Description

      (Related to QTBUG-66413. Since we switched to Qt 5.9.4 we have several major issues in our trees and tables, we caught them in our unit tests and squish tests.)

       

      We have a model with no row, and several columns. Some of the columns are hidden. The view is sorting on one of the visible columns. If a reset of the model is triggered all the hidden columns become visible again even though there is no change in the number of columns.

      The reset triggers an update of the sorting, _q_layoutAboutToBeChanged is called and clears layoutChangePersistentSections. Then when q_layoutChanged is called the visibility cannot be restored.

      As noted in the comment inside _q_layoutAboutToBeChanged the fact that the design relies on indices of the first row is problematic. 

      LayoutChangeItem {
          QPersistentModelIndex index;  // cannot have one on a model with no row
          SectionItem section;
      };

      I attached a test demonstrating the issue.

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-66444
          # Subject Branch Project Status CR V

          Activity

            People

              thorbjornlm Thorbjørn Martsum
              cassan Claire Cassan
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes