CXX-Qt - Safe interop between Rust and Qt
TLDR: Click here for "Getting Started" guide
This library provides a safe mechanism for bridging between Qt code and Rust code differently from typical Rust Qt bindings.
We acknowledge that Qt code and Rust code have different idioms so cannot be directly wrapped from one to another.
Instead of one-to-one bindings we use CXX to bridge between, this allows for normal Qt code and normal Rust code.
We feel this is more powerful than typical bindings as this allows us to provide a safe API and safe multi-threading between Qt and Rust.
To aid integration of Qt and Rust code we provide common Qt types for Rust which can pass across the bridge and provide ways to express common Qt idioms.
Through the use of macros and code generation as seen in the figure below, the developer describes a QObject
with CXX-Qt macro annotations. Then CXX-Qt generates the C++ representation of the object and uses macro expansion to define the CXX bridge for interop between C++ and Rust.
If you are new to CXX-Qt, we recommend you visit our Getting Started Guide.
To get detailed information on which features are available in CXX-Qt, see the bridge chapter. Should you be interested in a deeper dive into the concepts of CXX-Qt, take a look at the concepts chapter, which explains the concepts CXX-Qt introduces in detail.
📝 Note: CXX-Qt is tested on CI on Linux, Windows, and macOS (all on x86_64). wasm32 is compiled, but not tested on CI. It should work on other platforms that Qt and Rust both support, however, these are not tested regularly.