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

QHeaderView sectionResizeMode is reset after setting an item in the model

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Fixed
    • Affects Version/s: 5.12.4
    • Fix Version/s: 5.15.0 Alpha
    • Component/s: Core: Item Models
    • Labels:
      None
    • Environment:
      I have tested this on Windows 10 and macOS 10.14
    • Platform/s:
      All
    • Commits:
      e076965542148b8c2341fd4418733febbf9ae1ec 4522b17159a29ffd12c4d93be8a6e8e1a05dccd0 (qt/qtbase/dev)

      Description

      I have a QTableView combined with a QStandardItemModel.

      The first section i the horizontal header of the QTableView has a Stretch resizeMode and the second one a Fixed resizeMode.

      When QStandardItemModel::setItem is called, the resizeMode of the first section is reset to a Interactive resizeMode.

      In the attached example, when you click the "Update" button, QStandardItemModel::setItem is called which sets a new item in the topleft cell of the table. At that moment you see the width of the first column changing because its sectionResizeMode has changed

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              chehrlic Christian Ehrlicher
              Reporter:
              dbutijn David Butijn
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes