-
Notifications
You must be signed in to change notification settings - Fork 78
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
Examples with QtWidgets #610
Comments
We haven't made those yet. Hopefully I'll get around to it in the next couple weeks. Closing as a duplicate of #143. |
Note that exposing QObjects / list models from Rust -> a C++ widgets app is no different to using QML. Driving widgets from Rust only should be simpler now we support normal CXX extern blocks. Just that a lot of the widgets API is pointer driven, so you either need to pass around raw pointers in Rust (which uses unsafe blocks) or have wrapper methods that convert these to/from UniquePtr/SharedPtr. Some of this could likely be templated though. And I also am unsure about trying to add widgets API into cxx-qt-lib as that is a huge surface of API to support. I think instead having enough templated C++ methods that can be used or documented how to do it would be more useful. |
@ahayzen-kdab |
Note that it is very easy to expose C++ types through to Rust via CXX opaque type, eg if one wanted to use unsafe extern "C++" {
type QPainter;
include!(<QtGui/QPainter>);
#[rust_name = "fill_rect"]
fn fillRect(self: Pin<&mut QPainter>, rectangle: &QRectF, color: &QColor);
} However we are also evaluating which common types make sense for us to maintain in cxx-qt-lib to avoid boilerplate for the developer etc. Also note that other types have more things to gain from us providing types, as for types such as QString we are able to mark it as trivial for CXX rather than it being an opaque type (as QPainter is here below), whereas types like QPainter are likely not possible to be made trivial so there is a cost to benefit battle here. I do think it's likely that we'll be adding more types and/or helpers for you to reach the types over time though, but we are also still evolving the main API. |
Hello!
I am looking for examples of QtWidget (not QML/QtQuick). Where can I find it?
The text was updated successfully, but these errors were encountered: