Qt: Invalidate tooltips for title changes as well

Probably unnecessary since I don't think it's cached.
This commit is contained in:
Stenzek
2025-12-14 12:22:08 +10:00
parent 7cf6e04257
commit 3fc563e5a3
2 changed files with 10 additions and 6 deletions

View File

@@ -520,12 +520,16 @@ void GameListModel::rowsChanged(const QList<int>& rows)
}
}
Qt::ItemDataRole GameListModel::getRoleToInvalidate(int column)
QList<int> GameListModel::getRolesToInvalidate(int column)
{
QList<int> ret;
if (column == Column_Icon || column == Column_Cover || column == Column_Region)
return Qt::DecorationRole;
ret = {Qt::DecorationRole};
else
return Qt::DisplayRole;
ret = {Qt::DisplayRole, Qt::ToolTipRole};
return ret;
}
void GameListModel::invalidateColumn(int column, bool invalidate_cache /* = true */)
@@ -544,7 +548,7 @@ void GameListModel::invalidateColumn(int column, bool invalidate_cache /* = true
}
}
emit dataChanged(index(0, column), index(rowCount() - 1, column), {getRoleToInvalidate(column)});
emit dataChanged(index(0, column), index(rowCount() - 1, column), getRolesToInvalidate(column));
}
void GameListModel::invalidateColumnForPath(const std::string& path, int column, bool invalidate_cache /* = true */)
@@ -569,7 +573,7 @@ void GameListModel::invalidateColumnForPath(const std::string& path, int column,
const auto remove_entry = [this, &column](const GameList::Entry* ge, int row) {
const QModelIndex mi(index(row, column));
emit dataChanged(mi, mi, {getRoleToInvalidate(column)});
emit dataChanged(mi, mi, getRolesToInvalidate(column));
};
if (hasTakenGameList())

View File

@@ -154,7 +154,7 @@ private:
static void createPlaceholderImage(QImage& image, const QImage& placeholder_image, const QSize& size, float scale,
const QString& title);
static Qt::ItemDataRole getRoleToInvalidate(int column);
static QList<int> getRolesToInvalidate(int column);
const QPixmap& getIconPixmapForEntry(const GameList::Entry* ge) const;
const QPixmap& getFlagPixmapForEntry(const GameList::Entry* ge) const;