Skip to main content

QPropertyMember

Trait QPropertyMember 

Source
pub trait QPropertyMember: Sized {
    // Required methods
    fn qmetatype() -> QMetaType;
    fn to_qvariant<Owner>(&self, owner: &Owner) -> QVariant
       where Owner: QObjectHolder;
    fn from_qvariant(value: &QVariant) -> Result<Self, ()>;
    fn property_eq(&self, other: &Self) -> bool;

    // Provided method
    fn to_qvariant_view<Owner, Notify>(
        &self,
        owner: &Owner,
        notify: Notify,
    ) -> QVariant
       where Owner: QObjectHolder,
             Notify: Fn(&mut Owner) + 'static { ... }
}
Expand description

Enables a type to be used as a property.

Implemented for:

You will not need to implement this trait yourself; adding support for custom types requires CXX/C++ bindings.

Required Methods§

Source

fn qmetatype() -> QMetaType

Source

fn to_qvariant<Owner>(&self, owner: &Owner) -> QVariant
where Owner: QObjectHolder,

Returns a QVariant representation of self for read operations. Owner is the QObjectHolder that holds this property; passing it allows returning views onto its members and borrowing correctly on access. If the member is passed by value, owner can be ignored.

Source

fn from_qvariant(value: &QVariant) -> Result<Self, ()>

Converts value into the concrete type, used for write operations.

Source

fn property_eq(&self, other: &Self) -> bool

Returns true if self and other are equal. Used to decide whether the notify signal should be emitted and the stored value replaced on a property write.

Provided Methods§

Source

fn to_qvariant_view<Owner, Notify>( &self, owner: &Owner, notify: Notify, ) -> QVariant
where Owner: QObjectHolder, Notify: Fn(&mut Owner) + 'static,

Returns a QVariant view of self for read operations, with access to the property’s notify signal. Unlike to_qvariant, this variant can return a live view that emits notify when the underlying data changes.

The default implementation ignores notify and falls back to to_qvariant.

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.

Implementations on Foreign Types§

Source§

impl QPropertyMember for Value

Available on crate feature serde_json only.
Source§

fn qmetatype() -> QMetaType

Source§

fn to_qvariant<Owner>(&self, _owner: &Owner) -> QVariant
where Owner: QObjectHolder,

Source§

fn from_qvariant(value: &QVariant) -> Result<Value, ()>

Source§

fn property_eq(&self, other: &Value) -> bool

Source§

impl QPropertyMember for bool

Source§

fn qmetatype() -> QMetaType

Source§

fn to_qvariant<Owner>(&self, _owner: &Owner) -> QVariant
where Owner: QObjectHolder,

Source§

fn from_qvariant(value: &QVariant) -> Result<bool, ()>

Source§

fn property_eq(&self, other: &bool) -> bool

Source§

impl QPropertyMember for f32

Source§

fn qmetatype() -> QMetaType

Source§

fn to_qvariant<Owner>(&self, _owner: &Owner) -> QVariant
where Owner: QObjectHolder,

Source§

fn from_qvariant(value: &QVariant) -> Result<f32, ()>

Source§

fn property_eq(&self, other: &f32) -> bool

Source§

impl QPropertyMember for f64

Source§

fn qmetatype() -> QMetaType

Source§

fn to_qvariant<Owner>(&self, _owner: &Owner) -> QVariant
where Owner: QObjectHolder,

Source§

fn from_qvariant(value: &QVariant) -> Result<f64, ()>

Source§

fn property_eq(&self, other: &f64) -> bool

Source§

impl QPropertyMember for i8

Source§

fn qmetatype() -> QMetaType

Source§

fn to_qvariant<Owner>(&self, _owner: &Owner) -> QVariant
where Owner: QObjectHolder,

Source§

fn from_qvariant(value: &QVariant) -> Result<i8, ()>

Source§

fn property_eq(&self, other: &i8) -> bool

Source§

impl QPropertyMember for i16

Source§

fn qmetatype() -> QMetaType

Source§

fn to_qvariant<Owner>(&self, _owner: &Owner) -> QVariant
where Owner: QObjectHolder,

Source§

fn from_qvariant(value: &QVariant) -> Result<i16, ()>

Source§

fn property_eq(&self, other: &i16) -> bool

Source§

impl QPropertyMember for i32

Source§

fn qmetatype() -> QMetaType

Source§

fn to_qvariant<Owner>(&self, _owner: &Owner) -> QVariant
where Owner: QObjectHolder,

Source§

fn from_qvariant(value: &QVariant) -> Result<i32, ()>

Source§

fn property_eq(&self, other: &i32) -> bool

Source§

impl QPropertyMember for i64

Source§

fn qmetatype() -> QMetaType

Source§

fn to_qvariant<Owner>(&self, _owner: &Owner) -> QVariant
where Owner: QObjectHolder,

Source§

fn from_qvariant(value: &QVariant) -> Result<i64, ()>

Source§

fn property_eq(&self, other: &i64) -> bool

Source§

impl QPropertyMember for isize

Source§

fn qmetatype() -> QMetaType

Source§

fn to_qvariant<Owner>(&self, _owner: &Owner) -> QVariant
where Owner: QObjectHolder,

Source§

fn from_qvariant(value: &QVariant) -> Result<isize, ()>

Source§

fn property_eq(&self, other: &isize) -> bool

Source§

impl QPropertyMember for u8

Source§

fn qmetatype() -> QMetaType

Source§

fn to_qvariant<Owner>(&self, _owner: &Owner) -> QVariant
where Owner: QObjectHolder,

Source§

fn from_qvariant(value: &QVariant) -> Result<u8, ()>

Source§

fn property_eq(&self, other: &u8) -> bool

Source§

impl QPropertyMember for u16

Source§

fn qmetatype() -> QMetaType

Source§

fn to_qvariant<Owner>(&self, _owner: &Owner) -> QVariant
where Owner: QObjectHolder,

Source§

fn from_qvariant(value: &QVariant) -> Result<u16, ()>

Source§

fn property_eq(&self, other: &u16) -> bool

Source§

impl QPropertyMember for u32

Source§

fn qmetatype() -> QMetaType

Source§

fn to_qvariant<Owner>(&self, _owner: &Owner) -> QVariant
where Owner: QObjectHolder,

Source§

fn from_qvariant(value: &QVariant) -> Result<u32, ()>

Source§

fn property_eq(&self, other: &u32) -> bool

Source§

impl QPropertyMember for u64

Source§

fn qmetatype() -> QMetaType

Source§

fn to_qvariant<Owner>(&self, _owner: &Owner) -> QVariant
where Owner: QObjectHolder,

Source§

fn from_qvariant(value: &QVariant) -> Result<u64, ()>

Source§

fn property_eq(&self, other: &u64) -> bool

Source§

impl QPropertyMember for usize

Source§

fn qmetatype() -> QMetaType

Source§

fn to_qvariant<Owner>(&self, _owner: &Owner) -> QVariant
where Owner: QObjectHolder,

Source§

fn from_qvariant(value: &QVariant) -> Result<usize, ()>

Source§

fn property_eq(&self, other: &usize) -> bool

Source§

impl QPropertyMember for String

Source§

fn qmetatype() -> QMetaType

Source§

fn to_qvariant<Owner>(&self, _owner: &Owner) -> QVariant
where Owner: QObjectHolder,

Source§

fn from_qvariant(value: &QVariant) -> Result<String, ()>

Source§

fn property_eq(&self, other: &String) -> bool

Source§

impl QPropertyMember for Vec<Value>

Available on crate feature serde_json only.
Source§

fn qmetatype() -> QMetaType

Source§

fn to_qvariant<Owner>(&self, _owner: &Owner) -> QVariant
where Owner: QObjectHolder,

Source§

fn from_qvariant(value: &QVariant) -> Result<Vec<Value>, ()>

Source§

fn property_eq(&self, other: &Vec<Value>) -> bool

Source§

impl QPropertyMember for Vec<bool>

Source§

fn qmetatype() -> QMetaType

Source§

fn to_qvariant<Owner>(&self, _owner: &Owner) -> QVariant
where Owner: QObjectHolder,

Source§

fn from_qvariant(value: &QVariant) -> Result<Vec<bool>, ()>

Source§

fn property_eq(&self, other: &Vec<bool>) -> bool

Source§

impl QPropertyMember for Vec<f32>

Source§

fn qmetatype() -> QMetaType

Source§

fn to_qvariant<Owner>(&self, _owner: &Owner) -> QVariant
where Owner: QObjectHolder,

Source§

fn from_qvariant(value: &QVariant) -> Result<Vec<f32>, ()>

Source§

fn property_eq(&self, other: &Vec<f32>) -> bool

Source§

impl QPropertyMember for Vec<f64>

Source§

fn qmetatype() -> QMetaType

Source§

fn to_qvariant<Owner>(&self, _owner: &Owner) -> QVariant
where Owner: QObjectHolder,

Source§

fn from_qvariant(value: &QVariant) -> Result<Vec<f64>, ()>

Source§

fn property_eq(&self, other: &Vec<f64>) -> bool

Source§

impl QPropertyMember for Vec<i8>

Source§

fn qmetatype() -> QMetaType

Source§

fn to_qvariant<Owner>(&self, _owner: &Owner) -> QVariant
where Owner: QObjectHolder,

Source§

fn from_qvariant(value: &QVariant) -> Result<Vec<i8>, ()>

Source§

fn property_eq(&self, other: &Vec<i8>) -> bool

Source§

impl QPropertyMember for Vec<i16>

Source§

fn qmetatype() -> QMetaType

Source§

fn to_qvariant<Owner>(&self, _owner: &Owner) -> QVariant
where Owner: QObjectHolder,

Source§

fn from_qvariant(value: &QVariant) -> Result<Vec<i16>, ()>

Source§

fn property_eq(&self, other: &Vec<i16>) -> bool

Source§

impl QPropertyMember for Vec<i32>

Source§

fn qmetatype() -> QMetaType

Source§

fn to_qvariant<Owner>(&self, _owner: &Owner) -> QVariant
where Owner: QObjectHolder,

Source§

fn from_qvariant(value: &QVariant) -> Result<Vec<i32>, ()>

Source§

fn property_eq(&self, other: &Vec<i32>) -> bool

Source§

impl QPropertyMember for Vec<i64>

Source§

fn qmetatype() -> QMetaType

Source§

fn to_qvariant<Owner>(&self, _owner: &Owner) -> QVariant
where Owner: QObjectHolder,

Source§

fn from_qvariant(value: &QVariant) -> Result<Vec<i64>, ()>

Source§

fn property_eq(&self, other: &Vec<i64>) -> bool

Source§

impl QPropertyMember for Vec<isize>

Source§

fn qmetatype() -> QMetaType

Source§

fn to_qvariant<Owner>(&self, _owner: &Owner) -> QVariant
where Owner: QObjectHolder,

Source§

fn from_qvariant(value: &QVariant) -> Result<Vec<isize>, ()>

Source§

fn property_eq(&self, other: &Vec<isize>) -> bool

Source§

impl QPropertyMember for Vec<u8>

Source§

fn qmetatype() -> QMetaType

Source§

fn to_qvariant<Owner>(&self, _owner: &Owner) -> QVariant
where Owner: QObjectHolder,

Source§

fn from_qvariant(value: &QVariant) -> Result<Vec<u8>, ()>

Source§

fn property_eq(&self, other: &Vec<u8>) -> bool

Source§

impl QPropertyMember for Vec<u16>

Source§

fn qmetatype() -> QMetaType

Source§

fn to_qvariant<Owner>(&self, _owner: &Owner) -> QVariant
where Owner: QObjectHolder,

Source§

fn from_qvariant(value: &QVariant) -> Result<Vec<u16>, ()>

Source§

fn property_eq(&self, other: &Vec<u16>) -> bool

Source§

impl QPropertyMember for Vec<u32>

Source§

fn qmetatype() -> QMetaType

Source§

fn to_qvariant<Owner>(&self, _owner: &Owner) -> QVariant
where Owner: QObjectHolder,

Source§

fn from_qvariant(value: &QVariant) -> Result<Vec<u32>, ()>

Source§

fn property_eq(&self, other: &Vec<u32>) -> bool

Source§

impl QPropertyMember for Vec<u64>

Source§

fn qmetatype() -> QMetaType

Source§

fn to_qvariant<Owner>(&self, _owner: &Owner) -> QVariant
where Owner: QObjectHolder,

Source§

fn from_qvariant(value: &QVariant) -> Result<Vec<u64>, ()>

Source§

fn property_eq(&self, other: &Vec<u64>) -> bool

Source§

impl QPropertyMember for Vec<usize>

Source§

fn qmetatype() -> QMetaType

Source§

fn to_qvariant<Owner>(&self, _owner: &Owner) -> QVariant
where Owner: QObjectHolder,

Source§

fn from_qvariant(value: &QVariant) -> Result<Vec<usize>, ()>

Source§

fn property_eq(&self, other: &Vec<usize>) -> bool

Source§

impl QPropertyMember for Vec<String>

Source§

fn qmetatype() -> QMetaType

Source§

fn to_qvariant<Owner>(&self, _owner: &Owner) -> QVariant
where Owner: QObjectHolder,

Source§

fn from_qvariant(value: &QVariant) -> Result<Vec<String>, ()>

Source§

fn property_eq(&self, other: &Vec<String>) -> bool

Source§

impl<T> QPropertyMember for Rc<RefCell<T>>
where T: QObjectHolder,

Source§

fn qmetatype() -> QMetaType

Source§

fn to_qvariant<Owner>(&self, _owner: &Owner) -> QVariant
where Owner: QObjectHolder,

Source§

fn from_qvariant(value: &QVariant) -> Result<Rc<RefCell<T>>, ()>

Source§

fn property_eq(&self, other: &Rc<RefCell<T>>) -> bool

Source§

impl<T> QPropertyMember for Vec<Rc<RefCell<T>>>
where T: QmlRegister,

Source§

fn qmetatype() -> QMetaType

Source§

fn to_qvariant<Owner>(&self, owner: &Owner) -> QVariant
where Owner: QObjectHolder,

Source§

fn to_qvariant_view<Owner, Notify>( &self, owner: &Owner, notify: Notify, ) -> QVariant
where Owner: QObjectHolder, Notify: Fn(&mut Owner) + 'static,

Source§

fn from_qvariant(_value: &QVariant) -> Result<Vec<Rc<RefCell<T>>>, ()>

Source§

fn property_eq(&self, other: &Vec<Rc<RefCell<T>>>) -> bool

Implementors§