mirror of
https://github.com/stenzek/duckstation.git
synced 2025-07-19 00:20:12 +00:00
Qt: Fix game list icons when toggling disc set merging
Also, make sure we call beginFilterChange() in the proxy model as mentioned in the Qt docs.
This commit is contained in:
parent
4b5be29eb2
commit
2f13538cc0
@ -143,11 +143,15 @@ void GameListModel::setShowGameIcons(bool enabled)
|
||||
{
|
||||
m_show_game_icons = enabled;
|
||||
|
||||
beginResetModel();
|
||||
m_memcard_pixmap_cache.Clear();
|
||||
if (enabled)
|
||||
GameList::ReloadMemcardTimestampCache();
|
||||
endResetModel();
|
||||
refreshIcons();
|
||||
}
|
||||
|
||||
void GameListModel::refreshIcons()
|
||||
{
|
||||
m_memcard_pixmap_cache.Clear();
|
||||
emit dataChanged(index(0, Column_Icon), index(rowCount() - 1, Column_Icon), {Qt::DecorationRole});
|
||||
}
|
||||
|
||||
void GameListModel::setCoverScale(float scale)
|
||||
@ -305,7 +309,7 @@ void GameListModel::rowsChanged(const QList<int>& rows)
|
||||
}
|
||||
else
|
||||
{
|
||||
emit dataChanged(createIndex(rows[start], 0), createIndex(rows[idx], Column_Count - 1), roles_changed);
|
||||
emit dataChanged(index(rows[start], 0), index(rows[idx], Column_Count - 1), roles_changed);
|
||||
start = ++idx;
|
||||
}
|
||||
}
|
||||
@ -939,24 +943,28 @@ public:
|
||||
|
||||
void setMergeDiscSets(bool enabled)
|
||||
{
|
||||
beginFilterChange();
|
||||
m_merge_disc_sets = enabled;
|
||||
invalidateRowsFilter();
|
||||
}
|
||||
|
||||
void setFilterType(GameList::EntryType type)
|
||||
{
|
||||
beginFilterChange();
|
||||
m_filter_type = type;
|
||||
invalidateRowsFilter();
|
||||
}
|
||||
|
||||
void setFilterRegion(DiscRegion region)
|
||||
{
|
||||
beginFilterChange();
|
||||
m_filter_region = region;
|
||||
invalidateRowsFilter();
|
||||
}
|
||||
|
||||
void setFilterName(std::string name)
|
||||
{
|
||||
beginFilterChange();
|
||||
m_filter_name = std::move(name);
|
||||
std::transform(m_filter_name.begin(), m_filter_name.end(), m_filter_name.begin(), StringUtil::ToLower);
|
||||
invalidateRowsFilter();
|
||||
@ -1241,11 +1249,6 @@ void GameListWidget::refresh(bool invalidate_cache)
|
||||
m_refresh_thread->start();
|
||||
}
|
||||
|
||||
void GameListWidget::refreshModel()
|
||||
{
|
||||
m_model->refresh();
|
||||
}
|
||||
|
||||
void GameListWidget::cancelRefresh()
|
||||
{
|
||||
if (!m_refresh_thread)
|
||||
@ -1445,6 +1448,7 @@ void GameListWidget::setMergeDiscSets(bool enabled)
|
||||
Host::SetBaseBoolSettingValue("UI", "GameListMergeDiscSets", enabled);
|
||||
Host::CommitBaseSettingChanges();
|
||||
m_sort_model->setMergeDiscSets(enabled);
|
||||
m_model->refreshIcons();
|
||||
}
|
||||
|
||||
void GameListWidget::setShowGameIcons(bool enabled)
|
||||
|
@ -90,6 +90,7 @@ public:
|
||||
bool getShowGameIcons() const { return m_show_game_icons; }
|
||||
void setShowGameIcons(bool enabled);
|
||||
QIcon getIconForGame(const QString& path);
|
||||
void refreshIcons();
|
||||
|
||||
float getCoverScale() const { return m_cover_scale; }
|
||||
void setCoverScale(float scale);
|
||||
@ -101,10 +102,8 @@ public:
|
||||
Q_SIGNALS:
|
||||
void coverScaleChanged(float scale);
|
||||
|
||||
private Q_SLOTS:
|
||||
void rowsChanged(const QList<int>& rows);
|
||||
|
||||
private:
|
||||
void rowsChanged(const QList<int>& rows);
|
||||
QVariant data(const QModelIndex& index, int role, const GameList::Entry* ge) const;
|
||||
|
||||
void loadCommonImages();
|
||||
@ -164,11 +163,10 @@ public:
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent* e) override;
|
||||
|
||||
private Q_SLOTS:
|
||||
private:
|
||||
void onHeaderSortIndicatorChanged(int, Qt::SortOrder);
|
||||
void onHeaderContextMenuRequested(const QPoint& point);
|
||||
|
||||
private:
|
||||
void loadColumnVisibilitySettings();
|
||||
void loadColumnSortSettings();
|
||||
void saveColumnSortSettings();
|
||||
@ -198,10 +196,8 @@ protected:
|
||||
void wheelEvent(QWheelEvent* e) override;
|
||||
void resizeEvent(QResizeEvent* e) override;
|
||||
|
||||
private Q_SLOTS:
|
||||
void onCoverScaleChanged(float scale);
|
||||
|
||||
private:
|
||||
void onCoverScaleChanged(float scale);
|
||||
void adjustZoom(float delta);
|
||||
|
||||
GameListModel* m_model = nullptr;
|
||||
@ -226,7 +222,6 @@ public:
|
||||
void resizeListViewColumnsToFit();
|
||||
|
||||
void refresh(bool invalidate_cache);
|
||||
void refreshModel();
|
||||
void cancelRefresh();
|
||||
void reloadThemeSpecificImages();
|
||||
void updateBackground(bool reload_image);
|
||||
|
@ -2738,7 +2738,7 @@ void MainWindow::refreshGameList(bool invalidate_cache)
|
||||
|
||||
void MainWindow::refreshGameListModel()
|
||||
{
|
||||
m_game_list_widget->refreshModel();
|
||||
m_game_list_widget->getModel()->refresh();
|
||||
}
|
||||
|
||||
void MainWindow::cancelGameListRefresh()
|
||||
|
Loading…
x
Reference in New Issue
Block a user