When updating, remove songs first, then add. This way if a non-key field is updated, song wont disappear!
This commit is contained in:
@@ -107,12 +107,12 @@ void Device::applyUpdate()
|
||||
QSet<Song> removed=currentSongs-updateSongs;
|
||||
QSet<Song> added=updateSongs-currentSongs;
|
||||
|
||||
foreach (const Song &s, added) {
|
||||
addSongToList(s);
|
||||
}
|
||||
foreach (const Song &s, removed) {
|
||||
removeSongFromList(s);
|
||||
}
|
||||
foreach (const Song &s, added) {
|
||||
addSongToList(s);
|
||||
}
|
||||
delete update;
|
||||
} else*/ {
|
||||
int oldCount=childCount();
|
||||
|
||||
@@ -545,12 +545,12 @@ bool MusicLibraryModel::update(const QSet<Song> &songs)
|
||||
QSet<Song> added=updateSongs-currentSongs;
|
||||
|
||||
bool updatedSongs=added.count()||removed.count();
|
||||
foreach (const Song &s, added) {
|
||||
addSongToList(s);
|
||||
}
|
||||
foreach (const Song &s, removed) {
|
||||
removeSongFromList(s);
|
||||
}
|
||||
foreach (const Song &s, added) {
|
||||
addSongToList(s);
|
||||
}
|
||||
return updatedSongs;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user