The bridge module reference
extern "RustQt"- exposing Rust types to Qt asQObject,Q_SIGNAL,Q_PROPERTYetcextern "C++Qt"- binding Qt features and types to Rust, such asQObject,Q_SIGNALetc- Shared types - shared enums between Rust and Qt, such as
Q_ENUM,Q_ENUM_NSetc - Attributes - working with namespaces, giving functions different names
- Traits - traits related to a CXX-Qt
QObject
The #[cxx_qt::bridge] macro functions very similarly to #[cxx::bridge]. This macro needs to be written above a Rust module definition.
This Rust module will then function like a normal CXX bridge, whilst also supporting the additional features added by CXX-Qt. Refer to the CXX documentation for details on how to describe the language boundary.
Don't forget to add the Rust source file to the
CxxQtBuilderin yourbuild.rsscript. For instructions, see the Getting Started guide.
The #[cxx_qt::bridge] macro supports the options in its attribute: