-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Fix OAuth2 configuration <--> JSON serialization/deserialization on QT6 #59702
Conversation
external/qjsonwrapper/Json.cpp
Outdated
QVariant val = object->property( metaproperty.name() ); | ||
#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) | ||
if ( ( val.metaType().flags() & QMetaType::IsEnumeration ) && | ||
val.canConvert( QMetaType::Int ) ) |
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.
canConvert has a different (stupid) meaning on Qt 6. Now it's "is there any way this variant can possibly be turned into a XXX", and the answer is almost always true. It no longer actually checks the value in the variant to do the test! 😱
The qt 6 correct way of doing this is to manually check the userType()
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.
(The above did fix things for me, and test_authmethod_authoauth2method)
I'm not totally sure to understand your suggestion. Do you mean just replace the call to metaType() by userType() ? And removing the test val.canConvert( QMetaType::Int )
? In this generic code, we don't know what exact enumeration type we have, but we want enumeration types to be converted to integers instead of strings (with numeric value) which was what happened without the fix
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.
yeah I'd suggest just changing val.canConvert( QMetaType::Int )
with val.userType() == QMetaType::Int
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.
yeah I'd suggest just changing
val.canConvert( QMetaType::Int )
withval.userType() == QMetaType::Int
that doesn't work. But I've just removed that test: all enumeration types can be converted to int, right ?
I wonder how much work is involved in dropping this dependency. AFAICS it's used in:
What do you think? |
Ping @m-kuhn , who I'm sure would be keen on seeing another embedded library dropped 🤣 |
🪟 Windows buildsDownload Windows builds of this PR for testing. 🪟 Windows Qt6 buildsDownload Windows Qt6 builds of this PR for testing. |
The backport to
stderr
stdout
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-queued_ltr_backports queued_ltr_backports
# Navigate to the new working tree
cd .worktrees/backport-queued_ltr_backports
# Create a new branch
git switch --create backport-59702-to-queued_ltr_backports
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick 41f54377e0e05c01b60963d5c648478ca9812f24
# Push it to GitHub
git push --set-upstream origin backport-59702-to-queued_ltr_backports
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-queued_ltr_backports Then, create a pull request where the |
queued_ltr_backport in #59730 |
No description provided.