Qt/GameList: Fix search messing up columns

This commit is contained in:
spycrab 2018-06-27 12:57:32 +02:00
parent beeb6754d2
commit 1ec0a39cf1
2 changed files with 20 additions and 11 deletions

View File

@ -121,17 +121,7 @@ void GameList::MakeListView()
m_list->setColumnWidth(GameListModel::COL_SIZE, 85); m_list->setColumnWidth(GameListModel::COL_SIZE, 85);
m_list->setColumnWidth(GameListModel::COL_ID, 70); m_list->setColumnWidth(GameListModel::COL_ID, 70);
m_list->setColumnHidden(GameListModel::COL_PLATFORM, !SConfig::GetInstance().m_showSystemColumn); UpdateColumnVisibility();
m_list->setColumnHidden(GameListModel::COL_BANNER, !SConfig::GetInstance().m_showBannerColumn);
m_list->setColumnHidden(GameListModel::COL_TITLE, !SConfig::GetInstance().m_showTitleColumn);
m_list->setColumnHidden(GameListModel::COL_DESCRIPTION,
!SConfig::GetInstance().m_showDescriptionColumn);
m_list->setColumnHidden(GameListModel::COL_MAKER, !SConfig::GetInstance().m_showMakerColumn);
m_list->setColumnHidden(GameListModel::COL_ID, !SConfig::GetInstance().m_showIDColumn);
m_list->setColumnHidden(GameListModel::COL_COUNTRY, !SConfig::GetInstance().m_showRegionColumn);
m_list->setColumnHidden(GameListModel::COL_SIZE, !SConfig::GetInstance().m_showSizeColumn);
m_list->setColumnHidden(GameListModel::COL_FILE_NAME,
!SConfig::GetInstance().m_showFileNameColumn);
m_list->verticalHeader()->hide(); m_list->verticalHeader()->hide();
m_list->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_list->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
@ -147,6 +137,21 @@ GameList::~GameList()
m_list->horizontalHeader()->saveState()); m_list->horizontalHeader()->saveState());
} }
void GameList::UpdateColumnVisibility()
{
m_list->setColumnHidden(GameListModel::COL_PLATFORM, !SConfig::GetInstance().m_showSystemColumn);
m_list->setColumnHidden(GameListModel::COL_BANNER, !SConfig::GetInstance().m_showBannerColumn);
m_list->setColumnHidden(GameListModel::COL_TITLE, !SConfig::GetInstance().m_showTitleColumn);
m_list->setColumnHidden(GameListModel::COL_DESCRIPTION,
!SConfig::GetInstance().m_showDescriptionColumn);
m_list->setColumnHidden(GameListModel::COL_MAKER, !SConfig::GetInstance().m_showMakerColumn);
m_list->setColumnHidden(GameListModel::COL_ID, !SConfig::GetInstance().m_showIDColumn);
m_list->setColumnHidden(GameListModel::COL_COUNTRY, !SConfig::GetInstance().m_showRegionColumn);
m_list->setColumnHidden(GameListModel::COL_SIZE, !SConfig::GetInstance().m_showSizeColumn);
m_list->setColumnHidden(GameListModel::COL_FILE_NAME,
!SConfig::GetInstance().m_showFileNameColumn);
}
void GameList::MakeEmptyView() void GameList::MakeEmptyView()
{ {
m_empty = new QLabel(this); m_empty = new QLabel(this);
@ -653,4 +658,6 @@ void GameList::SetSearchTerm(const QString& term)
m_list_proxy->invalidate(); m_list_proxy->invalidate();
m_grid_proxy->invalidate(); m_grid_proxy->invalidate();
UpdateColumnVisibility();
} }

View File

@ -55,6 +55,8 @@ private:
void ExportWiiSave(); void ExportWiiSave();
void CompressISO(); void CompressISO();
void ChangeDisc(); void ChangeDisc();
void UpdateColumnVisibility();
void OnHeaderViewChanged(); void OnHeaderViewChanged();
void OnSectionResized(int index, int, int); void OnSectionResized(int index, int, int);