Details
-
Bug
-
Resolution: Duplicate
-
Not Evaluated
-
None
-
5.9.4, 5.10.1
-
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.