Skip to content

Commit

Permalink
Remember last index
Browse files Browse the repository at this point in the history
  • Loading branch information
kraxarn committed May 9, 2020
1 parent 8fa14ee commit f635c69
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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<spt::Track> &tracks)
Expand Down

0 comments on commit f635c69

Please sign in to comment.