diff --git a/src/playlist/playlistview.cpp b/src/playlist/playlistview.cpp index cd0b5279d..b8a0338cf 100644 --- a/src/playlist/playlistview.cpp +++ b/src/playlist/playlistview.cpp @@ -89,6 +89,7 @@ PlaylistView::PlaylistView(QWidget *parent) setting_initial_header_layout_(false), upgrading_from_qheaderview_(false), read_only_settings_(true), + upgrading_from_version_(-1), glow_enabled_(true), currently_glowing_(false), glow_intensity_step_(0), @@ -255,6 +256,8 @@ void PlaylistView::LoadGeometry() { // New columns that we add are visible by default if the user has upgraded // Clementine. Hide them again here const int state_version = settings.value("state_version", 0).toInt(); + upgrading_from_version_ = state_version; + if (state_version < 1) { header_->HideSection(Playlist::Column_Rating); header_->HideSection(Playlist::Column_PlayCount); @@ -267,9 +270,6 @@ void PlaylistView::LoadGeometry() { if (state_version < 3) { header_->HideSection(Playlist::Column_Comment); } - if (state_version < 4) { - header_->SetColumnWidth(Playlist::Column_Source, 0.05); - } // Make sure at least one column is visible bool all_hidden = true; @@ -897,6 +897,13 @@ void PlaylistView::ReloadSettings() { header_->SetColumnWidth(Playlist::Column_Track, 0.05); setting_initial_header_layout_ = false; } + + if (upgrading_from_version_ != -1) { + if (upgrading_from_version_ < 4) { + header_->SetColumnWidth(Playlist::Column_Source, 0.05); + } + upgrading_from_version_ = -1; + } column_alignment_ = s.value("column_alignments").value(); if (column_alignment_.isEmpty()) { diff --git a/src/playlist/playlistview.h b/src/playlist/playlistview.h index 5392bb3a9..5942a37a6 100644 --- a/src/playlist/playlistview.h +++ b/src/playlist/playlistview.h @@ -168,6 +168,7 @@ class PlaylistView : public QTreeView { bool setting_initial_header_layout_; bool upgrading_from_qheaderview_; bool read_only_settings_; + int upgrading_from_version_; bool background_enabled_; diff --git a/src/widgets/stretchheaderview.cpp b/src/widgets/stretchheaderview.cpp index 7bc379d65..9f2b18996 100644 --- a/src/widgets/stretchheaderview.cpp +++ b/src/widgets/stretchheaderview.cpp @@ -270,6 +270,11 @@ bool StretchHeaderView::RestoreState(const QByteArray& data) { resizeSection(i, pixel_widths[i]); } } + + // Have we added more columns since the last time? + while (column_widths_.count() < count()) { + column_widths_ << 0; + } if (stretch_enabled_) { // In stretch mode, we've already set the proportional column widths so apply