PlaylistView: Set current index when automatically selecting track

Fixes #1825
This commit is contained in:
Jonas Kvinge
2025-12-14 04:02:40 +01:00
parent 592729d00b
commit 24d2adf363

View File

@@ -1445,9 +1445,9 @@ void PlaylistView::SongChanged(const Song &song) {
song_playing_ = song;
if (select_track_ && playlist_) {
clearSelection();
QItemSelection selection(playlist_->index(playlist_->current_row(), 0), playlist_->index(playlist_->current_row(), Playlist::ColumnCount - 1));
selectionModel()->select(selection, QItemSelectionModel::Select);
const QModelIndex current_index = playlist_->filter()->mapFromSource(playlist_->index(playlist_->current_row(), 0));
if (!current_index.isValid()) return;
selectionModel()->setCurrentIndex(current_index, QItemSelectionModel::ClearAndSelect|QItemSelectionModel::Rows);
}
}