Use std::bind in QtConcurrent::run() to fix compile with Qt 6

This commit is contained in:
Jonas Kvinge
2020-07-19 22:43:58 +02:00
parent ff73dd2183
commit eb270df835
6 changed files with 10 additions and 7 deletions

View File

@@ -1314,7 +1314,7 @@ void Playlist::Restore() {
collection_items_by_id_.clear();
cancel_restore_ = false;
QFuture<QList<PlaylistItemPtr>> future = QtConcurrent::run(backend_, &PlaylistBackend::GetPlaylistItems, id_);
QFuture<QList<PlaylistItemPtr>> future = QtConcurrent::run(std::bind(&PlaylistBackend::GetPlaylistItems, backend_, id_));
NewClosure(future, this, SLOT(ItemsLoaded(QFuture<PlaylistItemList>)), future);
}
@@ -1353,7 +1353,7 @@ void Playlist::ItemsLoaded(QFuture<PlaylistItemList> future) {
// Should we gray out deleted songs asynchronously on startup?
if (greyout) {
QtConcurrent::run(this, &Playlist::InvalidateDeletedSongs);
(void)QtConcurrent::run(std::bind(&Playlist::InvalidateDeletedSongs, this));
}
emit PlaylistLoaded();

View File

@@ -21,6 +21,7 @@
#include "config.h"
#include <memory>
#include <functional>
#include <QtGlobal>
#include <QObject>
@@ -211,7 +212,7 @@ void PlaylistManager::Save(int id, const QString &filename, Playlist::Path path_
}
else {
// Playlist is not in the playlist manager: probably save action was triggered from the left side bar and the playlist isn't loaded.
QFuture<QList<Song>> future = QtConcurrent::run(playlist_backend_, &PlaylistBackend::GetPlaylistSongs, id);
QFuture<QList<Song>> future = QtConcurrent::run(std::bind(&PlaylistBackend::GetPlaylistSongs, playlist_backend_, id));
NewClosure(future, this, SLOT(ItemsLoadedForSavePlaylist(QFuture<SongList>, QString, Playlist::Path)), future, filename, path_type);
}

View File

@@ -83,7 +83,7 @@ void SongLoaderInserter::Load(Playlist *destination, int row, bool play_now, boo
deleteLater();
}
else {
QtConcurrent::run(this, &SongLoaderInserter::AsyncLoad);
(void)QtConcurrent::run([=]{ AsyncLoad(); });
}
}