Prevent the last playlist column from being hidden, and check that at least one is visible on startup. Fixes issue #991
This commit is contained in:
parent
5e17e93360
commit
23f2530f59
|
@ -225,6 +225,18 @@ void PlaylistView::LoadGeometry() {
|
|||
if (state_version < 3) {
|
||||
header_->HideSection(Playlist::Column_Comment);
|
||||
}
|
||||
|
||||
// Make sure at least one column is visible
|
||||
bool all_hidden = true;
|
||||
for (int i=0 ; i<header_->count() ; ++i) {
|
||||
if (!header_->isSectionHidden(i) && header_->sectionSize(i) > 0) {
|
||||
all_hidden = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (all_hidden) {
|
||||
header_->ShowSection(Playlist::Column_Title);
|
||||
}
|
||||
}
|
||||
|
||||
void PlaylistView::SaveGeometry() {
|
||||
|
|
|
@ -95,6 +95,18 @@ void StretchHeaderView::UpdateWidths(const QList<int>& sections) {
|
|||
}
|
||||
|
||||
void StretchHeaderView::HideSection(int logical) {
|
||||
// Would this hide the last section?
|
||||
bool all_hidden = true;
|
||||
for (int i=0 ; i<count() ; ++i) {
|
||||
if (i != logical && !isSectionHidden(i) && sectionSize(i) > 0) {
|
||||
all_hidden = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (all_hidden) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!stretch_enabled_) {
|
||||
hideSection(logical);
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue