QHeaderView: Skip hidden sections on cascading resize

When a section is hidden, QHeaderViewPrivate::cascadingResize() does
resize a section even it is hidden. This leads to space between the
neighbor sections and also some unneeded calculations.

Task-number: QTBUG-54601
Change-Id: Ie139417ae2c77ef25e66cf628bfe400185f88ee8
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This commit is contained in:
Christian Ehrlicher 2017-10-31 19:47:12 +01:00
parent b4f4c384d9
commit 2937ab9e32

View File

@ -3539,6 +3539,8 @@ void QHeaderViewPrivate::cascadingResize(int visual, int newSize)
// cascade the section size change
for (int i = visual + 1; i < sectionCount(); ++i) {
if (isVisualIndexHidden(i))
continue;
if (!sectionIsCascadable(i))
continue;
int currentSectionSize = headerSectionSize(i);
@ -3581,6 +3583,8 @@ void QHeaderViewPrivate::cascadingResize(int visual, int newSize)
// cascade the section size change
if (delta < 0 && newSize < minimumSize) {
for (int i = visual - 1; i >= 0; --i) {
if (isVisualIndexHidden(i))
continue;
if (!sectionIsCascadable(i))
continue;
int sectionSize = headerSectionSize(i);
@ -3595,6 +3599,8 @@ void QHeaderViewPrivate::cascadingResize(int visual, int newSize)
// let the next section get the space from the resized section
if (!sectionResized) {
for (int i = visual + 1; i < sectionCount(); ++i) {
if (isVisualIndexHidden(i))
continue;
if (!sectionIsCascadable(i))
continue;
int currentSectionSize = headerSectionSize(i);