From a0111628fb397fd6400103458a781406ac3c2803 Mon Sep 17 00:00:00 2001 From: Silent Date: Sun, 20 Oct 2019 23:07:08 +0200 Subject: [PATCH] Fixup GameListModel::UpdateGame and columnCount - dataChanged takes "first" and "last" indices inclusive, not exclusive - columnCount should return 0 for valid parents --- Source/Core/DolphinQt/GameList/GameListModel.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/Core/DolphinQt/GameList/GameListModel.cpp b/Source/Core/DolphinQt/GameList/GameListModel.cpp index ba060ad705..f588c5b35b 100644 --- a/Source/Core/DolphinQt/GameList/GameListModel.cpp +++ b/Source/Core/DolphinQt/GameList/GameListModel.cpp @@ -28,7 +28,7 @@ GameListModel::GameListModel(QObject* parent) : QAbstractTableModel(parent) connect(&Settings::Instance(), &Settings::PathRemoved, &m_tracker, &GameTracker::RemoveDirectory); connect(&Settings::Instance(), &Settings::GameListRefreshRequested, &m_tracker, &GameTracker::RefreshAll); - connect(&Settings::Instance(), &Settings::TitleDBReloadRequested, this, + connect(&Settings::Instance(), &Settings::TitleDBReloadRequested, [this] { m_title_database = Core::TitleDatabase(); }); for (const QString& dir : Settings::Instance().GetPaths()) @@ -199,6 +199,8 @@ int GameListModel::rowCount(const QModelIndex& parent) const int GameListModel::columnCount(const QModelIndex& parent) const { + if (parent.isValid()) + return 0; return NUM_COLS; } @@ -297,7 +299,7 @@ void GameListModel::UpdateGame(const std::shared_ptr& else { m_games[index] = game; - emit dataChanged(createIndex(index, 0), createIndex(index + 1, columnCount(QModelIndex()))); + emit dataChanged(createIndex(index, 0), createIndex(index, columnCount(QModelIndex()) - 1)); } }