-
Notifications
You must be signed in to change notification settings - Fork 20
Qt 6.9: Return type for QObjectData_dynamicMetaObject is now const #195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
rcalixte
commented
Apr 10, 2025
- Closes Qt 6.9 not compiling - QObjectData_dynamicMetaObject invalid conversion from const #194
…taObject for Qt 6.9+
The macro is copied but shouldn't represent a licensing issue. I added the comment so that it would be clear. Feel free to modify it as needed. |
Thanks for the quick PR! LGTM 🚢 |
@@ -36,7 +36,13 @@ void miqt_exec_callback_QObject_disconnectNotify(QObject*, intptr_t, QMetaMethod | |||
} /* extern C */ | |||
#endif | |||
|
|||
// This method's return type was changed from non-const to const in Qt 6.9 | |||
#if QT_VERSION >= QT_VERSION_CHECK(6,9,0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can technically return the const pointer for all qt versions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this a type mismatch if the underlying type isn't const
? And couldn't it lead to undefined behavior on Qt versions under 6.9?
Ultimately, this is a stop-gap of sorts. Once we start building on a version at or above Qt 6.9, the patches in config-allowlist.go
can go away. (It probably makes sense to leave the remaining code... just in case. 😅)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once we start building
An interesting approach would actually be to generate the bindings for each qt version separately and use the #if
trick for any "new" features - ie one would start with 6.0 generating all of that, then gradually add each version as it happens, hidden behind #if
- then the mappings could / would work with any qt version that the user happens to have installed.
Isn't this a type mismatch
you can assign a non-const pointer to a const pointer of the same underlying type without issue, in general - the other direction is not allowed though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As well as running genbindings on every version of Qt and diffing/merging the results, the other step would be to run it for clang-linux, clang-mingw, and clang-osxcross to identify all the cross-platform functions (#59).