Struct cxx_qt_lib::QVariant
source · #[repr(C)]pub struct QVariant { /* private fields */ }
Expand description
The QVariant class acts like a union for the most common Qt data types.
Implementations§
source§impl QVariant
impl QVariant
sourcepub fn value<T: QVariantValue>(&self) -> Option<T>
pub fn value<T: QVariantValue>(&self) -> Option<T>
Returns the stored value converted to the template type T if QVariant::canConvert is true otherwise returns None
sourcepub fn value_or_default<T: QVariantValue>(&self) -> T
pub fn value_or_default<T: QVariantValue>(&self) -> T
Returns the stored value converted to the template type T
If the value cannot be converted, a default-constructed value will be returned.
Note that this calls the QVariant::value
method, without performance loss.
Whereas value
first calls QVariant::canConvert
.