From f635c690c947af0ba0953d2f8fd02fd5b54e3b85 Mon Sep 17 00:00:00 2001 From: kraxarn Date: Sat, 9 May 2020 17:17:20 +0200 Subject: [PATCH] Remember last index --- src/mainwindow.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 9c2ae70af..db198f86d 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -610,6 +610,8 @@ void MainWindow::openLyrics(const QString &artist, const QString &name) void MainWindow::refreshPlaylists() { + auto lastIndex = playlists == nullptr + ? -1 : playlists->currentRow(); spotify->playlists(&sptPlaylists); // Create or empty if (playlists == nullptr) @@ -622,6 +624,8 @@ void MainWindow::refreshPlaylists() auto item = new QListWidgetItem(playlist.name, playlists); item->setToolTip(playlist.description); } + if (lastIndex >= 0) + playlists->setCurrentRow(lastIndex); } bool MainWindow::loadSongs(const QVector &tracks)