Skip to content

add Qt5/6 compatibility typedef for qHash seed type#4292

Merged
uklotzde merged 1 commit intomixxxdj:mainfrom
Be-ing:qhash_qt6
Sep 19, 2021
Merged

add Qt5/6 compatibility typedef for qHash seed type#4292
uklotzde merged 1 commit intomixxxdj:mainfrom
Be-ing:qhash_qt6

Conversation

@Be-ing
Copy link
Copy Markdown
Contributor

@Be-ing Be-ing commented Sep 17, 2021

@github-actions github-actions Bot added the ui label Sep 17, 2021
Comment thread src/util/qhash.h Outdated
@Be-ing Be-ing changed the title add Qt5/6 compatibility macro for qHash seed type add Qt5/6 compatibility typedef for qHash seed type Sep 17, 2021
Comment thread src/util/qhash.h Outdated
@@ -0,0 +1,5 @@
#if QT_VERSION <= QT_VERSION_CHECK(6, 0, 0)
Copy link
Copy Markdown
Contributor

@uklotzde uklotzde Sep 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) ;)

Comment thread src/controllers/midi/midimessage.h Outdated
#include <cstdint>

#include "preferences/usersettings.h"
#include "util/qhash.h"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@uklotzde
Copy link
Copy Markdown
Contributor

I guess the the directory is a good start. We can migrate the existing hacks and workarounds step by step. LGTM

Copy link
Copy Markdown
Contributor

@uklotzde uklotzde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants