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

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

XMLWordPrintable

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

      (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.

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes