The bridge module reference

  • extern "RustQt" - exposing Rust types to Qt as QObject, Q_SIGNAL, Q_PROPERTY etc
  • extern "C++Qt" - binding Qt features and types to Rust, such as QObject, Q_SIGNAL etc
  • Shared types - shared enums between Rust and Qt, such as Q_ENUM, Q_ENUM_NS etc
  • 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 CxxQtBuilder in your build.rs script. For instructions, see the Getting Started guide.

The #[cxx_qt::bridge] macro supports the options in its attribute: