StretchHeaderView: Make sure section size never is zero

Fixes #1085
This commit is contained in:
Jonas Kvinge 2024-07-19 17:51:49 +02:00
parent 6543e4c5da
commit 1a8690e1f2
1 changed files with 7 additions and 1 deletions

View File

@ -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) {