diff --git a/src/widgets/stretchheaderview.cpp b/src/widgets/stretchheaderview.cpp index 217781cb..63d0b91e 100644 --- a/src/widgets/stretchheaderview.cpp +++ b/src/widgets/stretchheaderview.cpp @@ -145,7 +145,7 @@ bool StretchHeaderView::RestoreState(const QByteArray &state) { if (i < visual_indices.count()) { moveSection(visualIndex(visual_indices[i]), i); } - if (i < column_pixel_widths.count()) { + if (i < column_pixel_widths.count() && column_pixel_widths[i] > 0) { resizeSection(i, column_pixel_widths[i]); } setSectionHidden(i, !columns_visible.contains(i)); @@ -284,6 +284,12 @@ void StretchHeaderView::ShowSection(const int logical_index) { } + else { + if (sectionSize(logical_index) == 0) { + resizeSection(logical_index, defaultSectionSize()); + } + } + } void StretchHeaderView::HideSection(const int logical_index) {