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

Regression: Hidden columns reappear in QTreeView after calling QAbstractItemModel's beginMoveRows()/endMoveRows() methods

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • 5.9.4, 5.10.1
    • Widgets: Itemviews
    • None

    Description

      If a QTreeView widget has some columns hidden and the underlying model is modified by calling QAbstractItemModel::beginMoveRows() followed by QAbstractItemModel::endMoveRows(), the hidden columns reappear.

      Attached is a slightly modified version of the simpletreemodel example where pressing a button will swap 2 rows where the second column is hidden.

      On Qt 5.9.4 and 5.10.1 the hidden column reappears, while on Qt 5.9.3 it stays hidden.

      This seems to be related to QHeaderViewPrivate::_q_layoutAboutToBeChanged() slot not being called when calling QAbstractItemModel::beginMoveRows(), which results in the persistentHiddenSections list not being filled by this method. When the QHeaderViewPrivate::_q_layoutChanged() slot is later called as a result of calling QAbstractItemModel::endMoveRows(), the hidden sections are therefore not properly restored.

      Inserting or removing rows through beginInsertRows()/endInsertRows() or beginRemoveRows()/endRemoveRows() is not affected and the column stays hidden in both cases.

      Attachments

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

        Activity

          People

            chehrlic Christian Ehrlicher
            gehant Sebastien Gehant
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes