Skip to content

Commit 3fc563e

Browse files
committed
Qt: Invalidate tooltips for title changes as well
Probably unnecessary since I don't think it's cached.
1 parent 7cf6e04 commit 3fc563e

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/duckstation-qt/gamelistwidget.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -520,12 +520,16 @@ void GameListModel::rowsChanged(const QList<int>& rows)
520520
}
521521
}
522522

523-
Qt::ItemDataRole GameListModel::getRoleToInvalidate(int column)
523+
QList<int> GameListModel::getRolesToInvalidate(int column)
524524
{
525+
QList<int> ret;
526+
525527
if (column == Column_Icon || column == Column_Cover || column == Column_Region)
526-
return Qt::DecorationRole;
528+
ret = {Qt::DecorationRole};
527529
else
528-
return Qt::DisplayRole;
530+
ret = {Qt::DisplayRole, Qt::ToolTipRole};
531+
532+
return ret;
529533
}
530534

531535
void GameListModel::invalidateColumn(int column, bool invalidate_cache /* = true */)
@@ -544,7 +548,7 @@ void GameListModel::invalidateColumn(int column, bool invalidate_cache /* = true
544548
}
545549
}
546550

547-
emit dataChanged(index(0, column), index(rowCount() - 1, column), {getRoleToInvalidate(column)});
551+
emit dataChanged(index(0, column), index(rowCount() - 1, column), getRolesToInvalidate(column));
548552
}
549553

550554
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,
569573

570574
const auto remove_entry = [this, &column](const GameList::Entry* ge, int row) {
571575
const QModelIndex mi(index(row, column));
572-
emit dataChanged(mi, mi, {getRoleToInvalidate(column)});
576+
emit dataChanged(mi, mi, getRolesToInvalidate(column));
573577
};
574578

575579
if (hasTakenGameList())

src/duckstation-qt/gamelistwidget.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ class GameListModel final : public QAbstractTableModel
154154
static void createPlaceholderImage(QImage& image, const QImage& placeholder_image, const QSize& size, float scale,
155155
const QString& title);
156156

157-
static Qt::ItemDataRole getRoleToInvalidate(int column);
157+
static QList<int> getRolesToInvalidate(int column);
158158

159159
const QPixmap& getIconPixmapForEntry(const GameList::Entry* ge) const;
160160
const QPixmap& getFlagPixmapForEntry(const GameList::Entry* ge) const;

0 commit comments

Comments
 (0)