diff --git a/src/core/song.cpp b/src/core/song.cpp index 2d9a1718f..1670b8351 100644 --- a/src/core/song.cpp +++ b/src/core/song.cpp @@ -1500,7 +1500,11 @@ bool Song::operator!=(const Song &other) const { return source() != other.source() || url() != other.url() || beginning_nanosec() != other.beginning_nanosec(); } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +size_t qHash(const Song &song) { +#else uint qHash(const Song &song) { +#endif // Should compare the same fields as operator== return qHash(song.url().toString()) ^ qHash(song.beginning_nanosec()); } diff --git a/src/core/song.h b/src/core/song.h index d474ffcf4..22028300a 100644 --- a/src/core/song.h +++ b/src/core/song.h @@ -378,7 +378,11 @@ Q_DECLARE_METATYPE(Song) typedef QList SongList; Q_DECLARE_METATYPE(QList) +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +size_t qHash(const Song &song); +#else uint qHash(const Song &song); +#endif // Hash function using field checked in IsSimilar function uint HashSimilar(const Song &song); diff --git a/src/device/macosdevicelister.h b/src/device/macosdevicelister.h index a9fcbeae3..cc98f2f00 100644 --- a/src/device/macosdevicelister.h +++ b/src/device/macosdevicelister.h @@ -109,7 +109,11 @@ class MacOsDeviceLister : public DeviceLister { static QSet sMTPDeviceList; }; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +size_t qHash(const MacOsDeviceLister::MTPDevice& device); +#else uint qHash(const MacOsDeviceLister::MTPDevice& device); +#endif inline bool operator==(const MacOsDeviceLister::MTPDevice& a, const MacOsDeviceLister::MTPDevice& b) { return (a.vendor_id == b.vendor_id) && (a.product_id == b.product_id); } diff --git a/src/device/macosdevicelister.mm b/src/device/macosdevicelister.mm index 07d522063..9627f3944 100644 --- a/src/device/macosdevicelister.mm +++ b/src/device/macosdevicelister.mm @@ -100,7 +100,11 @@ class ScopedIOObject { QSet MacOsDeviceLister::sMTPDeviceList; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +size_t qHash(const MacOsDeviceLister::MTPDevice& d) { +#else uint qHash(const MacOsDeviceLister::MTPDevice& d) { +#endif return qHash(d.vendor_id) ^ qHash(d.product_id); } diff --git a/src/internet/internetsearchmodel.h b/src/internet/internetsearchmodel.h index 6a6fdac7f..9cc012b35 100644 --- a/src/internet/internetsearchmodel.h +++ b/src/internet/internetsearchmodel.h @@ -96,7 +96,11 @@ class InternetSearchModel : public QStandardItemModel { }; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +inline size_t qHash(const InternetSearchModel::ContainerKey &key) { +#else inline uint qHash(const InternetSearchModel::ContainerKey &key) { +#endif return qHash(key.group_[0]) ^ qHash(key.group_[1]) ^ qHash(key.group_[2]); } diff --git a/src/musicbrainz/musicbrainzclient.h b/src/musicbrainz/musicbrainzclient.h index cac4bc16c..8320837ce 100644 --- a/src/musicbrainz/musicbrainzclient.h +++ b/src/musicbrainz/musicbrainzclient.h @@ -218,7 +218,11 @@ class MusicBrainzClient : public QObject { }; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +inline size_t qHash(const MusicBrainzClient::Result& result) { +#else inline uint qHash(const MusicBrainzClient::Result& result) { +#endif return qHash(result.album_) ^ qHash(result.artist_) ^ result.duration_msec_ ^ qHash(result.title_) ^ result.track_ ^ result.year_; } diff --git a/src/playlist/playlistfilter.cpp b/src/playlist/playlistfilter.cpp index 84c2d89c8..40db18cf3 100644 --- a/src/playlist/playlistfilter.cpp +++ b/src/playlist/playlistfilter.cpp @@ -84,7 +84,11 @@ bool PlaylistFilter::filterAcceptsRow(int row, const QModelIndex &parent) const QString filter = filterRegExp().pattern(); #endif +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + size_t hash = qHash(filter); +#else uint hash = qHash(filter); +#endif if (hash != query_hash_) { // Parse the query FilterParser p(filter, column_names_, numerical_columns_); diff --git a/src/playlist/playlistfilter.h b/src/playlist/playlistfilter.h index a9a23d663..a1e79d9a0 100644 --- a/src/playlist/playlistfilter.h +++ b/src/playlist/playlistfilter.h @@ -47,10 +47,14 @@ class PlaylistFilter : public QSortFilterProxyModel { // public so Playlist::NextVirtualIndex and friends can get at it bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override; -private: + private: // Mutable because they're modified from filterAcceptsRow() const mutable QScopedPointer filter_tree_; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + mutable size_t query_hash_; +#else mutable uint query_hash_; +#endif QMap column_names_; QSet numerical_columns_;