pub trait QObject { // Required methods fnmeta_object(&self) ->*constQMetaObject; fnstatic_meta_object() ->*constQMetaObjectwhere Self:Sized; fnget_cpp_object(&self) ->*mutc_void; unsafe fncpp_construct(pined: &RefCell<Self>) ->*mutc_voidwhere Self:Sized; unsafe fnqml_construct( pined: &RefCell<Self>, mem:*mutc_void, extra_destruct: extern "C"fn(*mutc_void), )where Self:Sized; fncpp_size() ->usizewhere Self:Sized; unsafe fnget_from_cpp<'a>(p:*mutc_void) ->QObjectPinned<'a, Self>where Self:Sized; // Provided method fnget_object_description() -> &'static QObjectDescriptorwhere Self:Sized { ... }}
Expand description
Trait that is implemented by the QObject custom derive macro
Do not implement this trait yourself, use#[derive(QObject)]
.
The method of this trait fits into two categories: the ones that are re-implemented bythe custom derive, and the ones that are used by this macro and need to be implementedby other QObject-like trait which you use in the qt_base_class! macro.
Required Methods§
Sourcefnmeta_object(&self) ->*constQMetaObject
fnmeta_object(&self) ->*constQMetaObject
Returns a pointer to a meta object
Sourcefnstatic_meta_object() ->*constQMetaObjectwhere Self:Sized,
fnstatic_meta_object() ->*constQMetaObjectwhere Self:Sized,
Returns a pointer to a meta object
Sourcefnget_cpp_object(&self) ->*mutc_void
fnget_cpp_object(&self) ->*mutc_void
return a C++ pointer to the QObject* (can be null if not yet initialized)
Sourceunsafe fncpp_construct(pined: &RefCell<Self>) ->*mutc_voidwhere Self:Sized,
unsafe fncpp_construct(pined: &RefCell<Self>) ->*mutc_voidwhere Self:Sized,
Construct the C++ Object.
Note, once this function is called, the object must not be moved in memory.
Sourceunsafe fnqml_construct( pined: &RefCell<Self>, mem:*mutc_void, extra_destruct: extern "C"fn(*mutc_void),)where Self:Sized,
unsafe fnqml_construct( pined: &RefCell<Self>, mem:*mutc_void, extra_destruct: extern "C"fn(*mutc_void),)where Self:Sized,
Construct the C++ Object, suitable for callbacks to construct QML objects.
Sourceunsafe fnget_from_cpp<'a>(p:*mutc_void) ->QObjectPinned<'a, Self>where Self:Sized,
unsafe fnget_from_cpp<'a>(p:*mutc_void) ->QObjectPinned<'a, Self>where Self:Sized,
Return a rust object belonging to a C++ object
Provided Methods§
Sourcefnget_object_description() -> &'static QObjectDescriptorwhere Self:Sized,
fnget_object_description() -> &'static QObjectDescriptorwhere Self:Sized,
Returns a QObjectDescriptor for this type
Implementations§
Source§impl dynQObject
impl dynQObject
Sourcepub unsafe fnas_qvariant(&self) ->QVariant
pub unsafe fnas_qvariant(&self) ->QVariant
Creates a C++ object and construct a QVariant containing a pointer to it.
The cpp_construct function must already have been called.
FIXME: should probably not be used. Prefer using a QmlEngine::new_qobject.QVariant is unsafe as it does not manage life time
Sourcepub fndestroyed_signal() ->Signal<fn()>
pub fndestroyed_signal() ->Signal<fn()>
See Qt documentation for QObject::destroyed
Sourcepub fnset_object_name(&self, name:QString)
pub fnset_object_name(&self, name:QString)
See Qt documentation for QObject::setObjectName
Sourcepub fnobject_name_changed_signal() ->Signal<fn(QString)>
pub fnobject_name_changed_signal() ->Signal<fn(QString)>
See Qt documentation for QObject::objectNameChanged