Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.8.1
-
None
Description
In my implementation of QAbstractTableModel I have a slot that, when receiving the connected signal, resets the model by calling beginResetModel() and endResetModel().
The model is viewed with a QTableView.
When resetting the model, the number of columns and rows can change.
If i use default horizontal and vertical headers the table view is updated without problems.
If I manually set headers (even a simple instance of QHeaderView w/o any modification) the behavior depends on the order I set horizontal and vertical header.
If I set before the horizontal header and then the vertical, my app crashes when moving from a model that has a larger number of rows. Viceversa I don't have problems. It crashes because headerData() is called with a section number greater than the row count, accessing a list beyond boundary.
By looking at the stack trace I think that this is because the section count of vertical header is not updated when the reset method of the horizontal header is executed.
I didn't investigate why when moving from a model with a larger number of columns and headers set in the opposite way this problem doesn't occur.