Merge pull request #6663 from spycrab/qt_fix_columns

Qt: Fix columns not properly showing / hiding
This commit is contained in:
Mat M 2018-04-17 10:19:35 -04:00 committed by GitHub
commit e04592e6c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 19 deletions

View File

@ -84,18 +84,6 @@ void GameList::MakeListView()
emit SelectionChanged(GetSelectedGame());
});
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);
QHeaderView* hor_header = m_list->horizontalHeader();
connect(hor_header, &QHeaderView::sortIndicatorChanged, this, &GameList::OnHeaderViewChanged);
@ -117,6 +105,18 @@ void GameList::MakeListView()
hor_header->setSectionResizeMode(GameListModel::COL_SIZE, QHeaderView::ResizeToContents);
hor_header->setSectionResizeMode(GameListModel::COL_FILE_NAME, QHeaderView::Interactive);
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);
m_list->verticalHeader()->hide();
m_list->setFrameStyle(QFrame::NoFrame);
}
@ -485,15 +485,15 @@ void GameList::keyReleaseEvent(QKeyEvent* event)
void GameList::OnColumnVisibilityToggled(const QString& row, bool visible)
{
static const QMap<QString, int> rowname_to_col_index = {
{tr("Banner"), GameListModel::COL_BANNER},
{tr("Country"), GameListModel::COL_COUNTRY},
{tr("Description"), GameListModel::COL_DESCRIPTION},
{tr("ID"), GameListModel::COL_ID},
{tr("Maker"), GameListModel::COL_MAKER},
{tr("Platform"), GameListModel::COL_PLATFORM},
{tr("Size"), GameListModel::COL_SIZE},
{tr("Banner"), GameListModel::COL_BANNER},
{tr("Title"), GameListModel::COL_TITLE},
{tr("File Name"), GameListModel::COL_FILE_NAME}};
{tr("Description"), GameListModel::COL_DESCRIPTION},
{tr("Maker"), GameListModel::COL_MAKER},
{tr("File Name"), GameListModel::COL_FILE_NAME},
{tr("Game ID"), GameListModel::COL_ID},
{tr("Region"), GameListModel::COL_COUNTRY},
{tr("File Size"), GameListModel::COL_SIZE}};
m_list->setColumnHidden(rowname_to_col_index[row], !visible);
}