Fix game title sorting (#2286)

* Fix game title sorting

* fix

* fix

* fix
This commit is contained in:
DanielSvoboda 2025-01-30 15:34:42 -03:00 committed by GitHub
parent e805b97520
commit ad5bd91a13
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 3 deletions

View file

@ -69,7 +69,7 @@ GameListFrame::GameListFrame(std::shared_ptr<GameInfoClass> game_info_get,
ListSortedAsc = true;
}
this->clearContents();
PopulateGameList();
PopulateGameList(false);
});
connect(this, &QTableWidget::customContextMenuRequested, this, [=, this](const QPoint& pos) {
@ -103,7 +103,7 @@ void GameListFrame::PlayBackgroundMusic(QTableWidgetItem* item) {
BackgroundMusicPlayer::getInstance().playMusic(snd0path);
}
void GameListFrame::PopulateGameList() {
void GameListFrame::PopulateGameList(bool isInitialPopulation) {
// Do not show status column if it is not enabled
this->setColumnHidden(2, !Config::getCompatibilityEnabled());
this->setColumnHidden(6, !Config::GetLoadGameSizeEnabled());
@ -111,6 +111,11 @@ void GameListFrame::PopulateGameList() {
this->setRowCount(m_game_info->m_games.size());
ResizeIcons(icon_size);
if (isInitialPopulation) {
SortNameAscending(1); // Column 1 = Name
ResizeIcons(icon_size);
}
for (int i = 0; i < m_game_info->m_games.size(); i++) {
SetTableItem(i, 1, QString::fromStdString(m_game_info->m_games[i].name));
SetTableItem(i, 3, QString::fromStdString(m_game_info->m_games[i].serial));

View file

@ -46,7 +46,7 @@ private:
bool ListSortedAsc = true;
public:
void PopulateGameList();
void PopulateGameList(bool isInitialPopulation = true);
void ResizeIcons(int iconSize);
QImage backgroundImage;