GameListModel: Update tag list and sorting immediately

Emit the dataChanged signal when adding or removing tags from a game.
This both updates the contents of the game's Tags column immediately
(instead of having to wait for the context menu to be closed), and
updates the sorting if games are being sorted by the Tags column.
This commit is contained in:
Dentomologist
2025-06-16 22:11:09 -07:00
parent 2fd74990b7
commit c488545091

View File

@ -470,6 +470,13 @@ void GameListModel::AddGameTag(const std::string& path, const QString& name)
m_game_tags[QString::fromStdString(path)] = tags;
Settings::GetQSettings().setValue(QStringLiteral("gamelist/game_tags"), m_game_tags);
const int row = FindGameIndex(path);
if (row >= 0)
{
const QModelIndex index = createIndex(row, static_cast<int>(Column::Tags));
emit dataChanged(index, index);
}
}
void GameListModel::RemoveGameTag(const std::string& path, const QString& name)
@ -481,6 +488,13 @@ void GameListModel::RemoveGameTag(const std::string& path, const QString& name)
m_game_tags[QString::fromStdString(path)] = tags;
Settings::GetQSettings().setValue(QStringLiteral("gamelist/game_tags"), m_game_tags);
const int row = FindGameIndex(path);
if (row >= 0)
{
const QModelIndex index = createIndex(row, static_cast<int>(Column::Tags));
emit dataChanged(index, index);
}
}
void GameListModel::NewTag(const QString& name)