Skip to content

How to wrap a rust crate and then use it in Qt ? #972

Answered by LeonMatthesKDAB
dezbracaty asked this question in Q&A
Discussion options

You must be logged in to vote

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…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by LeonMatthesKDAB
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #971 on June 06, 2024 15:35.