Skip to main content

QmlElement

Trait QmlElement 

Source
pub trait QmlElement: QObjectHolder + Default {
    const URI: &str;
    const ELEMENT_NAME: &str;
    const MINOR_VERSION: u8;
    const MAJOR_VERSION: u8;
    const IS_SINGLETON: bool;

    // Provided methods
    fn get_qmetatype() -> QMetaType { ... }
    fn get_list_qmetatype() -> QMetaType { ... }
    unsafe fn list_to_qvariant<Owner, Notify>(
        owner: &Owner,
        store: &Vec<Rc<RefCell<Self>>>,
        _notify: Notify,
    ) -> QVariant
       where Owner: QObjectHolder,
             Notify: Fn(&mut Owner) + 'static { ... }
    fn register() { ... }
}

Required Associated Constants§

Provided Methods§

Source

fn get_qmetatype() -> QMetaType

Returns the QMetaType identifying this type, unique per concrete type.

The #[qobject] macro overrides this with a per-type OnceLock body; the default serves generic types and hand-written impls.

Source

fn get_list_qmetatype() -> QMetaType

Source

unsafe fn list_to_qvariant<Owner, Notify>( owner: &Owner, store: &Vec<Rc<RefCell<Self>>>, _notify: Notify, ) -> QVariant
where Owner: QObjectHolder, Notify: Fn(&mut Owner) + 'static,

Returns a QVariant holding a QQmlListProperty view onto store.

§Safety

store must be a field of owner: the list callbacks locate it through its byte offset within owner.

Source

fn register()

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§