From 63c2640032e1cd5dc1e9cde8c3bef525faa4ba03 Mon Sep 17 00:00:00 2001 From: David Sansome Date: Tue, 18 May 2010 18:19:19 +0000 Subject: [PATCH] Select the entire row when scrolling to the currently playing item. --- src/playlist/playlistview.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/playlist/playlistview.cpp b/src/playlist/playlistview.cpp index 84acf3267..7830cd924 100644 --- a/src/playlist/playlistview.cpp +++ b/src/playlist/playlistview.cpp @@ -379,8 +379,16 @@ void PlaylistView::JumpToCurrentlyPlayingTrack() { QModelIndex current = playlist->index(playlist->current_index(), 0); currently_autoscrolling_ = true; + + // Scroll to the item scrollTo(current, QAbstractItemView::PositionAtCenter); - selectionModel()->setCurrentIndex(current, QItemSelectionModel::ClearAndSelect); + + // Replace the selection. + // We have to get the whole row here, not just the current cell. + selectionModel()->select(current, + QItemSelectionModel::Clear | QItemSelectionModel::Select | + QItemSelectionModel::Current | QItemSelectionModel::Rows); + currently_autoscrolling_ = false; }