Replace use of QSet::fromList with Qt 5.14 and above

This commit is contained in:
Jonas Kvinge 2019-12-21 18:22:18 +01:00
parent 6df38c389c
commit be9bf5c173
4 changed files with 17 additions and 1 deletions

View File

@ -463,7 +463,11 @@ void CollectionView::ShowInVarious(bool on) {
}
}
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
for (const QString &album : QSet<QString>(albums.begin(), albums.end())) {
#else
for (const QString &album : QSet<QString>::fromList(albums.keys())) {
#endif
app_->collection_backend()->ForceCompilation(album, albums.values(album), on);
}

View File

@ -87,7 +87,11 @@ void StandardItemIconLoader::RowsAboutToBeRemoved(const QModelIndex &parent, int
void StandardItemIconLoader::ModelReset() {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
cover_loader_->CancelTasks(QSet<quint64>(pending_covers_.begin(), pending_covers_.end()));
#else
cover_loader_->CancelTasks(QSet<quint64>::fromList(pending_covers_.keys()));
#endif
pending_covers_.clear();
}

View File

@ -251,7 +251,11 @@ void AlbumCoverManager::closeEvent(QCloseEvent *e) {
void AlbumCoverManager::CancelRequests() {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
app_->album_cover_loader()->CancelTasks(QSet<quint64>(cover_loading_tasks_.begin(), cover_loading_tasks_.end()));
#else
app_->album_cover_loader()->CancelTasks(QSet<quint64>::fromList(cover_loading_tasks_.keys()));
#endif
cover_loading_tasks_.clear();
cover_exporter_->Cancel();

View File

@ -488,7 +488,11 @@ MusicBrainzClient::ResultList MusicBrainzClient::UniqueResults(const ResultList&
ResultList ret;
if (opt == SortResults) {
ret = QSet<Result>::fromList(results).toList();
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
ret = QSet<Result>(results.begin(), results.end()).values();
#else
ret = QSet<Result>::fromList(results).values();
#endif
std::sort(ret.begin(), ret.end());
}
else { // KeepOriginalOrder