Changing the default section size requires that we inform the parent
view of the header about size changes, and that we update the header
so that we repaint with the new section sizes. This didn't happen.
The private setDefaultSectionSize implementation does all that. However,
QHeaderView only remembers if the default section size was explicitly
overridden; it doesn't care if individual sections were resized, and
overwrites explicitly resized sections. This breaks QTreeView, where
calls to setColumnWidth resizes individual sections, but a style change
(e.g. when setting a style sheet, which results in posted events) would
then overwrite all section sizes with a new default.
To fix that, only resize those sections to the new default that had the
old default before.
This still breaks tests that assume that changing the default section
size will affect sections that have been explicitly resized. To make
those tests pass, and to minimize behavior changes, also resize sections
to the new default section size if they don't have a valid size before,
and adjust the problematic test to resize all sections to 0.
[ChangeLog][QtWidgets][QHeaderView] Changing the defaultSectionSize no
longer affects sections that don't have the old default size.
Fixes: QTBUG-116013
Change-Id: I02fee3f7fda66f4d982bacea1b4a8b14c896bb65
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 32578a088db5769e919a4ec5ebf33346479e7a68)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>