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

QHeaderView::resizeSection is overwritten by QHeaderView::event(StyleChange)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P2: Important
    • None
    • 6.6.1
    • Widgets: Itemviews
    • None

    Description

      Hi,

      Since Qt 6.6.1, setting a column width on a QTableView (using horizontalHeader() resizeSection) does not work. To make the column width stick, one need to call QHeaderView::setDefaultSectionSize to set d->customDefaultSectionSize to true.

      This is because in QHeaderView::event handler, when receiving QEvent.StyleChange event, the column width is reset to the default width from the style, unless a default section size has been set before.

      Commit reference:

      https://github.com/qt/qtbase/commit/a8df174369cecd90f14dac85bf162353b7cb25d1#diff-6fb831d1eb6f54475467c1c77a14b09a5ec51a0000ce861d8b42a9629bd81f2bL2388

      Attachments

        Issue Links

          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
              char101 Charles Gunawan
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes