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

after endResetModel() HeaderView call headerData() even if row and column numbers are zero

    XMLWordPrintable

Details

    • Linux/Wayland, Windows

    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.

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            fcancli Fabio Canclini
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes