Qt: Fix game list selection after Refresh(true)

This commit is contained in:
Megamouse 2026-03-17 18:03:53 +01:00
parent bc0c42b025
commit 43f3a4816d

View file

@ -412,10 +412,21 @@ void game_list_table::populate(
row++;
}
bool first_index = true;
for (int selected_row : selected_rows)
{
selectionModel()->select(model()->index(selected_row, 0), QItemSelectionModel::Select | QItemSelectionModel::Rows);
const QModelIndex index = model()->index(selected_row, 0);
selectionModel()->select(index, QItemSelectionModel::Select | QItemSelectionModel::Rows);
if (first_index)
{
selectionModel()->setCurrentIndex(index, QItemSelectionModel::NoUpdate);
first_index = false;
}
}
Q_EMIT itemSelectionChanged();
}
void game_list_table::repaint_icons(std::vector<game_info>& game_data, const QColor& icon_color, const QSize& icon_size, qreal device_pixel_ratio)