Refactor playlist view/header code

- Don't reload all settings when changing playlists
- Fix initial playlist header columns sizes
- Properly reset header state when resetting columns
This commit is contained in:
Jonas Kvinge
2020-08-29 19:55:00 +02:00
parent 4c3f86aa4d
commit 08f32d1de6
8 changed files with 181 additions and 157 deletions

View File

@@ -52,6 +52,7 @@ class StretchHeaderView : public QHeaderView {
// Use these instead of QHeaderView::restoreState and QHeaderView::saveState to persist the proportional values directly and avoid floating point errors over time.
bool RestoreState(const QByteArray &sdata);
QByteArray SaveState() const;
QByteArray ResetState();
// Hides a section and resizes all other sections to fill the gap. Does nothing if you try to hide the last section.
void HideSection(const int logical);
@@ -85,7 +86,7 @@ class StretchHeaderView : public QHeaderView {
private:
// Scales column_widths_ values so the total is 1.0.
void NormaliseWidths(const QList<int>& sections = QList<int>());
void NormaliseWidths(const QList<int> &sections = QList<int>());
// Resizes the actual columns to make them match the proportional values in column_widths_.
void UpdateWidths(const QList<int>& sections = QList<int>());