Skip to main content

QMetaInfo

Trait QMetaInfo 

Source
pub trait QMetaInfo: 'static {
    type CppProxy: QCppProxy;

    // Required methods
    fn build_dynamic_meta_type(
        meta_obj_builder: Pin<&mut DynamicMetaObjectBuilder>,
    );
    fn get_shared_dynamic_meta_object_data() -> &'static DynamicMetaObjectData;

    // Provided methods
    fn class_name() -> &'static str { ... }
    fn create_dynamic_meta_object_data_for_type(    ) -> *const DynamicMetaObjectData { ... }
}
Expand description

Extends a C++ QObject’s static meta-object with signals, slots, and properties defined on the Rust side, producing a dynamic meta-object that QMetaObject introspection system can query as if the type were a native QObject subclass.

The associated QCppProxy provides the parent static QMetaObject as well as some other information; implementors (usually qtbridge macros) supply Self::build_dynamic_meta_type to declare the Rust-side additions and Self::get_shared_dynamic_meta_object_data to return a cached instance of the built meta-object data. Other functions provide a reasonable default implementation

Required Associated Types§

Source

type CppProxy: QCppProxy

The CppProxy provides the static meta-object

Required Methods§

Source

fn build_dynamic_meta_type(meta_obj_builder: Pin<&mut DynamicMetaObjectBuilder>)

This function takes the meta_obj_builder and builds a meta object that contains all slots, signals and properties for the respective type. This function is usually implemented by a macro.

Source

fn get_shared_dynamic_meta_object_data() -> &'static DynamicMetaObjectData

Return DynamicMetaObjectData containing information about signals/slots/properties for given Rust object.

Provided Methods§

Source

fn class_name() -> &'static str

The class_name in the Qt meta-object system

Source

fn create_dynamic_meta_object_data_for_type() -> *const DynamicMetaObjectData

Creates a new DynamicMetaObjectData object and returns a raw pointer to the heap-allocated object. Ownership is not managed internally; the caller is responsible for it.

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§