diff --git a/src/qt_gui/game_list_frame.cpp b/src/qt_gui/game_list_frame.cpp index 9753f511b..8255c0daf 100644 --- a/src/qt_gui/game_list_frame.cpp +++ b/src/qt_gui/game_list_frame.cpp @@ -69,7 +69,7 @@ GameListFrame::GameListFrame(std::shared_ptr 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)); diff --git a/src/qt_gui/game_list_frame.h b/src/qt_gui/game_list_frame.h index 90d021093..7e37c4ea7 100644 --- a/src/qt_gui/game_list_frame.h +++ b/src/qt_gui/game_list_frame.h @@ -46,7 +46,7 @@ private: bool ListSortedAsc = true; public: - void PopulateGameList(); + void PopulateGameList(bool isInitialPopulation = true); void ResizeIcons(int iconSize); QImage backgroundImage;