add Qt5/6 compatibility typedef for qHash seed type#4292
add Qt5/6 compatibility typedef for qHash seed type#4292uklotzde merged 1 commit intomixxxdj:mainfrom
Conversation
| @@ -0,0 +1,5 @@ | |||
| #if QT_VERSION <= QT_VERSION_CHECK(6, 0, 0) | |||
There was a problem hiding this comment.
Minor nitpick: Please use >= and exchange the arms. The legacy code should be in the 2nd arm. That's how we do it usually, just search for QT_VERSION_CHECK. Will prevent mistakes when removing the conditionals in the future.
There was a problem hiding this comment.
Somehow that doesn't build??
#if QT_VERSION_CHECK(6, 0, 0) >= QT_VERSION
typedef size_t qhash_seed_t;
#else
typedef uint qhash_seed_t;
#endif
../src/track/trackref.h:137:18: error: call of overloaded ‘qHash(const TrackId&, qhash_seed_t&)’ is ambiguous
137 | qHash(key.getId(), seed);
| ~~~~~^~~~~~~~~~~~~~~~~~~
There was a problem hiding this comment.
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) ;)
| #include <cstdint> | ||
|
|
||
| #include "preferences/usersettings.h" | ||
| #include "util/qhash.h" |
There was a problem hiding this comment.
I think we have a compatibility.h header file that we should use instead of adding a new header for each Qt6 class. Or maybe add a single new qtcompat.h file?
There was a problem hiding this comment.
A single file would pull in many unused Qt dependencies. We already have qtmutex.h.
We should definitely agree on some pattern. Introducing a new subdirectory util/qtcompat with separate header files could also be an option.
|
I guess the the directory is a good start. We can migrate the existing hacks and workarounds step by step. LGTM |
https://doc-snapshots.qt.io/qt6-6.2/qtcore-changes-qt6.html#qhash-signature