#[qobject]
Expand description
A macro which describes that a struct should be made into a QObject.
It should not be used by itself and instead should be used inside a cxx_qt::bridge definition.
§Example
#[cxx_qt::bridge]
mod my_object {
extern "RustQt" {
#[qobject]
type MyObject = super::MyObjectRust;
}
}
#[derive(Default)]
pub struct MyObjectRust;
You can also specify a custom base class by using #[base = "QStringListModel"]
, you must then use CXX to add any includes needed.
§Example
#[cxx_qt::bridge]
mod my_object {
extern "RustQt" {
#[qobject]
#[base = "QStringListModel"]
type MyModel = super::MyModelRust;
}
unsafe extern "C++" {
include!(<QtCore/QStringListModel>);
}
}
#[derive(Default)]
pub struct MyModelRust;