Qt: Bring column selection up to par with Wx

This commit is contained in:
spycrab 2017-09-13 21:57:53 +02:00
parent b0f93f2acc
commit e7318fda34
4 changed files with 11 additions and 3 deletions

View File

@ -108,6 +108,7 @@ void GameList::MakeListView()
hor_header->setSectionResizeMode(GameListModel::COL_BANNER, QHeaderView::ResizeToContents);
hor_header->setSectionResizeMode(GameListModel::COL_TITLE, QHeaderView::Stretch);
hor_header->setSectionResizeMode(GameListModel::COL_MAKER, QHeaderView::Stretch);
hor_header->setSectionResizeMode(GameListModel::COL_FILE_NAME, QHeaderView::ResizeToContents);
hor_header->setSectionResizeMode(GameListModel::COL_SIZE, QHeaderView::ResizeToContents);
hor_header->setSectionResizeMode(GameListModel::COL_DESCRIPTION, QHeaderView::Stretch);
hor_header->setSectionResizeMode(GameListModel::COL_RATING, QHeaderView::ResizeToContents);

View File

@ -98,6 +98,9 @@ QVariant GameListModel::data(const QModelIndex& index, int role) const
if (role == Qt::DisplayRole || role == Qt::InitialSortOrderRole)
return game->GetMaker();
break;
case COL_FILE_NAME:
if (role == Qt::DisplayRole || role == Qt::InitialSortOrderRole)
return game->GetFileName();
case COL_SIZE:
if (role == Qt::DisplayRole)
return FormatSize(game->GetFileSize());
@ -126,6 +129,8 @@ QVariant GameListModel::headerData(int section, Qt::Orientation orientation, int
return tr("Description");
case COL_MAKER:
return tr("Maker");
case COL_FILE_NAME:
return tr("File Name");
case COL_SIZE:
return tr("Size");
case COL_RATING:

View File

@ -42,6 +42,7 @@ public:
COL_COUNTRY,
COL_SIZE,
COL_RATING,
COL_FILE_NAME,
NUM_COLS
};

View File

@ -328,13 +328,14 @@ void MenuBar::AddListColumnsMenu(QMenu* view_menu)
{
static const QMap<QString, bool*> columns{
{tr("Platform"), &SConfig::GetInstance().m_showSystemColumn},
{tr("ID"), &SConfig::GetInstance().m_showIDColumn},
{tr("Banner"), &SConfig::GetInstance().m_showBannerColumn},
{tr("Title"), &SConfig::GetInstance().m_showTitleColumn},
{tr("Description"), &SConfig::GetInstance().m_showDescriptionColumn},
{tr("Maker"), &SConfig::GetInstance().m_showMakerColumn},
{tr("Size"), &SConfig::GetInstance().m_showSizeColumn},
{tr("Country"), &SConfig::GetInstance().m_showRegionColumn},
{tr("File Name"), &SConfig::GetInstance().m_showFileNameColumn},
{tr("Game ID"), &SConfig::GetInstance().m_showIDColumn},
{tr("Region"), &SConfig::GetInstance().m_showRegionColumn},
{tr("File Size"), &SConfig::GetInstance().m_showSizeColumn},
{tr("State"), &SConfig::GetInstance().m_showStateColumn}};
QActionGroup* column_group = new QActionGroup(this);