Skip to content
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

Missing QVariant -> Primitive Type Conversions #74

Open
Ace4896 opened this issue Feb 6, 2020 · 2 comments · May be fixed by #136
Open

Missing QVariant -> Primitive Type Conversions #74

Ace4896 opened this issue Feb 6, 2020 · 2 comments · May be fixed by #136
Labels
A-wrappers Area: Wrappers and bindings C-feature-request Category: A feature request, i.e: not implemented / a PR. E-easy Call for participation: Experience needed to fix: Easy / not much P-high High priority

Comments

@Ace4896
Copy link
Contributor

Ace4896 commented Feb 6, 2020

Recently I found that the QVariant wrapper can be created from Rust's primitive types (i32, f32 etc.), but there isn't a way to directly convert it back into a primitive type.

I'd take this on if I have free time, but what I've thought of so far is implementing TryInto<...> for the QVariant wrapper (since the conversion can fail).

@ogoffart
Copy link
Member

ogoffart commented Feb 7, 2020

You can use the QMetaType trait for that: there is QMetaType::from_qvariant.

But yes, i agree that having TryInto would also make sense!

@Ace4896
Copy link
Contributor Author

Ace4896 commented Feb 7, 2020

Ah, looks like I completely missed it 😅 But yeah, I think having TryInto would make the type conversion things easier to find.

@ratijas ratijas added A-wrappers Area: Wrappers and bindings C-feature-request Category: A feature request, i.e: not implemented / a PR. E-easy Call for participation: Experience needed to fix: Easy / not much P-high High priority labels Jun 30, 2021
@ratijas ratijas linked a pull request Jul 23, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-wrappers Area: Wrappers and bindings C-feature-request Category: A feature request, i.e: not implemented / a PR. E-easy Call for participation: Experience needed to fix: Easy / not much P-high High priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants