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:
David Sansome 2010-12-11 14:26:49 +00:00
parent 5e17e93360
commit 23f2530f59
2 changed files with 24 additions and 0 deletions

View File

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

View File

@ -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;