We just released CXX-Qt version 0.4!
CXX-Qt is a set of Rust crates for creating bidirectional Rust ⇄ C++ bindings with Qt. It can be used to integrate Rust into C++ applications using CMake or build Rust applications with Cargo. CXX-Qt provides tools for implementing QObject subclasses in Rust that can be used from C++, QML, and JavaScript.
For 0.4, most of the internals of CXX-Qt have been refactored into stages, which means it is easier to maintain. There are various small changes to the API, such as the capability of using attributes in more places rather than magic struct names. Relocatable Qt types have been marked as trivial to CXX (which means they don't need to be wrapped in pointers).
Some of the larger developer-facing changes are listed below.
Refactor of API So That CXX-Qt is a Superset of CXX
You can now combine CXX definitions into the CXX-Qt bridge macro.
This allows you to define custom types with CXX extern blocks that can then be used for CXX-Qt purposes, such as properties, invokables, and signals.
For example, in the bridge below, a CXX extern "C++" block is used to define QString as a type. Then, this can be used as a property in the QObject definition.
3 Comments
26 - Nov - 2022
AdamSmith
To use this tool, a user has to master 1.C++, 2. Rust, 3.Qt.
The bar is too high.
1 - Feb - 2023
Andrew Hayzen
Hi Adam,
Yes we understand that this is an advanced tool. It is aimed at established Qt developers who also have some knowledge of Rust and want to join the two ecosystems in their application. To make things simpler for Rust developers we also hope to reduce the amount of C++ you need to write, allow you to build with cargo only, and improve documentation and examples. But otherwise we are dealing with complex languages and tools so unfortunately it is going to require some understanding of either side of the bridge.
Thanks,
Andrew
15 - Feb - 2023
DooMWhite
Anyhow, I'm happy that at least someone is trying to make it possible.