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

QHeaderView::resetDefaultSectionSize doesn't invalidate cached size hints / update view

    XMLWordPrintable

Details

    • Windows
    • a8df17436 (dev), 4253b2b6e (6.6), 36465be5c (tqtc/lts-6.5)

    Description

      Hello,

      We ran into a bug with QHeaderView::resetDefaultSize.

      For some back story, we have a table view that displays a list of parameters. As a configuration setting, users can switch between different parameter page "densities" / row height to show more or less parameters for a given view size.

      We can achieve this by toggling the value we use when calling QHeaderView::setDefaultSectionSize on the vertical header for this view to a "smaller" value in order to achieve a more "Compact" density and a smaller row height.

      However, when we "reset" the view back to defaults using resetDefaultSectionSize, the view doesn't automatically update the row height like we expect.

      Going default -> compact via setDefaultSectionSize works and updates.

      But going back from compact -> default via resetDefaultSectionSize doesn't.

      We're thinking it's likely related to invalidating the size hints here:
      https://github.com/qt/qtbase/blob/af457a9f0f7eb1a2a7d11f495da508faab91a442/src/widgets/itemviews/qheaderview.cpp#L3878

      Which doesn't seem to occur when resetting.

      Attached is a motivating example which illustrates the bug.

      If you click the "Apply Workaround" checkbox, you can apply our workaround to the bug (which resets, then calls setDefaultSectionSize followed by another reset)

      Thanks,
      Ryan

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-116013
          # Subject Branch Project Status CR V

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              thornto4 Ryan Thornton
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes