From 8da8b04813ebe73ad7cda11b340e7a450f6289c8 Mon Sep 17 00:00:00 2001 From: David Sansome Date: Wed, 3 Feb 2010 21:26:54 +0000 Subject: [PATCH] Fix persistent indexes when rearranging the playlist --- src/playlist.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/playlist.cpp b/src/playlist.cpp index 4fbb0bdea..1e76282fe 100644 --- a/src/playlist.cpp +++ b/src/playlist.cpp @@ -182,11 +182,25 @@ bool Playlist::dropMimeData(const QMimeData* data, Qt::DropAction action, int ro const int start = row == -1 ? items_.count() : row; for (int i=start ; i source_row) + d --; + } + if (pidx.row() + d >= start) + d += source_rows.count(); + + changePersistentIndex(pidx, index(pidx.row() + d, pidx.column(), QModelIndex())); + } } layoutChanged();