StretchHeaderView: Properly implement reset

This commit is contained in:
Jonas Kvinge 2024-07-20 15:19:28 +02:00
parent d303e700ae
commit da3876bd83
1 changed files with 11 additions and 3 deletions

View File

@ -171,11 +171,19 @@ bool StretchHeaderView::RestoreState(const QByteArray &state) {
QByteArray StretchHeaderView::ResetState() {
stretch_enabled_ = true;
stretch_enabled_ = false;
column_widths_.resize(count());
std::fill(column_widths_.begin(), column_widths_.end(), 1.0 / count());
setSortIndicator(0, Qt::AscendingOrder);
setSortIndicator(-1, Qt::AscendingOrder);
return QByteArray();
for (int i = 0; i < count(); ++i) {
setSectionHidden(i, false);
resizeSection(i, defaultSectionSize());
moveSection(visualIndex(i), i);
}
return SaveState();
}