Merge pull request #7171 from spycrab/qt_search_fix

Qt/GameList: Fix search messing up columns
This commit is contained in:
spycrab 2018-06-27 14:08:44 +02:00 committed by GitHub
commit 52dd41fa95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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_ID, 70);
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);
UpdateColumnVisibility();
m_list->verticalHeader()->hide();
m_list->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
@ -147,6 +137,21 @@ GameList::~GameList()
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()
{
m_empty = new QLabel(this);
@ -653,4 +658,6 @@ void GameList::SetSearchTerm(const QString& term)
m_list_proxy->invalidate();
m_grid_proxy->invalidate();
UpdateColumnVisibility();
}

View File

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