UniquePtr's usage and discussions #247
Unanswered
ahayzen-kdab
asked this question in
Ideas
Replies: 1 comment
-
This is now less relevant as we pass around items as trivial as we can as Qt if they are relocatable :-) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
For opaque C++ types we need to use UniquePtr or references to pass them around on the Rust side of the bridge.
Places where UniquePtr is used
Note that parameters in invokables can take a reference to the C++ opaque type so don't need to be a UniquePtr
Problems
#[qproperty(cxx_type = "T")]
or#[qinvokable(return_cxx_type = "T")]
or#[cxx_type = "T"]
on signal argumentsfn base_method(self: &DerivedClass) -> CppOpaqueType
this won't workfn base_method(self: &DerivedClass) -> UniquePtr<CppOpaqueType>
which would mean the developer needs to write a load of wrapping code for their base class methodsSolutions
as_ref()
can be used hereUniquePtr<QColor>
to become a reference*self.prop
?Beta Was this translation helpful? Give feedback.
All reactions