diff --git a/Source/Core/DolphinQt2/GameList/GameListModel.cpp b/Source/Core/DolphinQt2/GameList/GameListModel.cpp index 01fb41c176..f7381253a7 100644 --- a/Source/Core/DolphinQt2/GameList/GameListModel.cpp +++ b/Source/Core/DolphinQt2/GameList/GameListModel.cpp @@ -208,19 +208,22 @@ QSharedPointer GameListModel::GetGameFile(int index) const return m_games[index]; } -void GameListModel::UpdateGame(QSharedPointer game) +void GameListModel::UpdateGame(const QSharedPointer& game) { QString path = game->GetFilePath(); - int entry = FindGame(path); - if (entry < 0) - entry = m_games.size(); + int index = FindGame(path); + if (index < 0) + { + beginInsertRows(QModelIndex(), m_games.size(), m_games.size()); + m_games.push_back(game); + endInsertRows(); + } else - return; - - beginInsertRows(QModelIndex(), entry, entry); - m_games.insert(entry, game); - endInsertRows(); + { + m_games[index] = game; + emit dataChanged(createIndex(index, 0), createIndex(index + 1, columnCount(QModelIndex()))); + } } void GameListModel::RemoveGame(const QString& path) diff --git a/Source/Core/DolphinQt2/GameList/GameListModel.h b/Source/Core/DolphinQt2/GameList/GameListModel.h index 7e3d926f86..02e9ee2842 100644 --- a/Source/Core/DolphinQt2/GameList/GameListModel.h +++ b/Source/Core/DolphinQt2/GameList/GameListModel.h @@ -45,7 +45,7 @@ public: NUM_COLS }; - void UpdateGame(QSharedPointer game); + void UpdateGame(const QSharedPointer& game); void RemoveGame(const QString& path); private: