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

source

pub fn clear(&mut self)

Convert this variant to type QMetaType::UnknownType and free up any resources used.

source§

impl QVariant

source

pub fn is_null(&self) -> bool

Returns true if this is a null variant, false otherwise.

source§

impl QVariant

source

pub fn is_valid(&self) -> bool

Returns true if the storage type of this variant is not QMetaType::UnknownType; otherwise returns false.

source§

impl QVariant

source

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

source

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.

Trait Implementations§

source§

impl Clone for QVariant

source§

fn clone(&self) -> Self

Constructs a copy of the variant, p, passed as the argument to this constructor.

1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Default for QVariant

source§

fn default() -> Self

Constructs an invalid variant.

source§

impl Drop for QVariant

source§

fn drop(&mut self)

Destroys the QVariant and the contained object.

source§

impl ExternType for QVariant

§

type Id = (Q, V, a, r, i, a, n, t)

A type-level representation of the type’s C++ namespace and type name. Read more
§

type Kind = Trivial

source§

impl<T> From<&T> for QVariant
where T: QVariantValue,

source§

fn from(value: &T) -> Self

Constructs a QVariant from a value of T

source§

impl PartialEq for QVariant

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl QListElement for QVariant

§

type TypeId = (Q, L, i, s, t, __, Q, V, a, r, i, a, n, t)

source§

fn append(list: &mut QList<Self>, value: Self)

source§

fn append_clone(list: &mut QList<Self>, value: &Self)

source§

fn clear(list: &mut QList<Self>)

source§

fn clone(list: &QList<Self>) -> QList<Self>

source§

fn contains(list: &QList<Self>, value: &Self) -> bool

source§

fn default() -> QList<Self>

source§

fn drop(list: &mut QList<Self>)

source§

unsafe fn get_unchecked(list: &QList<Self>, pos: isize) -> &Self

Safety Read more
source§

fn index_of(list: &QList<Self>, value: &Self) -> isize

source§

fn insert(list: &mut QList<Self>, pos: isize, value: Self)

source§

fn insert_clone(list: &mut QList<Self>, pos: isize, value: &Self)

source§

fn len(list: &QList<Self>) -> isize

source§

fn remove(list: &mut QList<Self>, pos: isize)

source§

fn reserve(list: &mut QList<Self>, size: isize)

source§

impl QVectorElement for QVariant

§

type TypeId = (Q, V, e, c, t, o, r, __, Q, V, a, r, i, a, n, t)

source§

fn append(vector: &mut QVector<Self>, value: Self)

source§

fn append_clone(vector: &mut QVector<Self>, value: &Self)

source§

fn clear(vector: &mut QVector<Self>)

source§

fn clone(vector: &QVector<Self>) -> QVector<Self>

source§

fn contains(vector: &QVector<Self>, value: &Self) -> bool

source§

fn default() -> QVector<Self>

source§

fn drop(vector: &mut QVector<Self>)

source§

unsafe fn get_unchecked(vector: &QVector<Self>, pos: isize) -> &Self

Safety Read more
source§

fn index_of(vector: &QVector<Self>, value: &Self) -> isize

source§

fn insert(vector: &mut QVector<Self>, pos: isize, value: Self)

source§

fn insert_clone(vector: &mut QVector<Self>, pos: isize, value: &Self)

source§

fn len(vector: &QVector<Self>) -> isize

source§

fn remove(vector: &mut QVector<Self>, pos: isize)

source§

fn reserve(vector: &mut QVector<Self>, size: isize)

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.