Skip to content

Commit

Permalink
Fixup GameListModel::UpdateGame and columnCount
Browse files Browse the repository at this point in the history
- dataChanged takes "first" and "last" indices inclusive, not exclusive
- columnCount should return 0 for valid parents
  • Loading branch information
CookiePLMonster committed Oct 20, 2019
1 parent 6282b0d commit a011162
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Source/Core/DolphinQt/GameList/GameListModel.cpp
Expand Up @@ -28,7 +28,7 @@ GameListModel::GameListModel(QObject* parent) : QAbstractTableModel(parent)
connect(&Settings::Instance(), &Settings::PathRemoved, &m_tracker, &GameTracker::RemoveDirectory); connect(&Settings::Instance(), &Settings::PathRemoved, &m_tracker, &GameTracker::RemoveDirectory);
connect(&Settings::Instance(), &Settings::GameListRefreshRequested, &m_tracker, connect(&Settings::Instance(), &Settings::GameListRefreshRequested, &m_tracker,
&GameTracker::RefreshAll); &GameTracker::RefreshAll);
connect(&Settings::Instance(), &Settings::TitleDBReloadRequested, this, connect(&Settings::Instance(), &Settings::TitleDBReloadRequested,
[this] { m_title_database = Core::TitleDatabase(); }); [this] { m_title_database = Core::TitleDatabase(); });


for (const QString& dir : Settings::Instance().GetPaths()) for (const QString& dir : Settings::Instance().GetPaths())
Expand Down Expand Up @@ -199,6 +199,8 @@ int GameListModel::rowCount(const QModelIndex& parent) const


int GameListModel::columnCount(const QModelIndex& parent) const int GameListModel::columnCount(const QModelIndex& parent) const
{ {
if (parent.isValid())
return 0;
return NUM_COLS; return NUM_COLS;
} }


Expand Down Expand Up @@ -297,7 +299,7 @@ void GameListModel::UpdateGame(const std::shared_ptr<const UICommon::GameFile>&
else else
{ {
m_games[index] = game; m_games[index] = game;
emit dataChanged(createIndex(index, 0), createIndex(index + 1, columnCount(QModelIndex()))); emit dataChanged(createIndex(index, 0), createIndex(index, columnCount(QModelIndex()) - 1));
} }
} }


Expand Down

0 comments on commit a011162

Please sign in to comment.