How to wrap a rust crate and then use it in Qt ? #972
-
As title says, If I have a rust crate bevy, and I want to wrap this crate ,and then use it in Qt , can I use cxx-qt to archive it ? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @dezbracaty , As bevy is pretty huge, has loads of functionality and acts more as a framework than a normal library it can be tricky to wrap in particular. |
Beta Was this translation helpful? Give feedback.
-
Wow, thanks for you replying ~! It's very useful. I will learn it . |
Beta Was this translation helpful? Give feedback.
Hi @dezbracaty ,
In general, yes, that's pretty much what CXX-Qt is meant for.
You just add that crate as a dependency to your Cargo.toml and start creating QObjects with CXX-Qt that allow access to the functionality you want.
As bevy is pretty huge, has loads of functionality and acts more as a framework than a normal library it can be tricky to wrap in particular.
What functionality exactly would you want to wrap from bevy?
If you want to show the output of a bevy game in a Qt app, you may want to take a look at how we created a mini-browser for servo here: https://github.com/KDABLabs/cxx-qt-servo-webview
There we embed the OpenGL context from servo into a QML application. Something sim…