Macro qml::Q_REGISTERABLE_QML
[−]
[src]
macro_rules! Q_REGISTERABLE_QML { ($wrapper:ident : $origin:ident as $qml:ident $major:expr=>$minor:expr, from $uri:ident) => { ... }; }
Provides definitions for a type that can be used from QML.
The same macro is used to prepare a type for being used as a normal type or a singleton.
The only requirement is that the type in question should provide Default
implementation.
Examples
#[derive(Default)] pub struct Test; Q_OBJECT!( pub Test as QTest{ signals: slots: properties: name: String; read: get_name, write: set_name, notify: name_changed; }); Q_REGISTERABLE_QML!(QTest: Test as TestRsObject 1=>0, from TestModule);
Later on a type that was made registerable can be used in Q_REGISTER_QML
or in Q_REGISTER_SINGLETON_QML
macros to be used as a type in QML.