Use std::any_of

This commit is contained in:
Jonas Kvinge
2021-06-21 19:52:37 +02:00
parent 6a7959547e
commit c61d1ce6b4
12 changed files with 55 additions and 70 deletions

View File

@@ -187,12 +187,10 @@ bool CollectionView::RestoreLevelFocus(const QModelIndex &parent) {
case CollectionItem::Type_Song:
if (!last_selected_song_.url().isEmpty()) {
QModelIndex index = qobject_cast<QSortFilterProxyModel*>(model())->mapToSource(current);
SongList songs = app_->collection_model()->GetChildSongs(index);
for (const Song &song : songs) {
if (song == last_selected_song_) {
setCurrentIndex(current);
return true;
}
const SongList songs = app_->collection_model()->GetChildSongs(index);
if (std::any_of(songs.begin(), songs.end(), [this](const Song &song) { return song == last_selected_song_; })) {
setCurrentIndex(current);
return true;
}
}
break;