Trait qmetaobject::qmetatype::QMetaType[][src]

pub trait QMetaType: Clone + Default + 'static {
    const CONVERSION_TO_STRING: Option<fn(_: &Self) -> QString>;
    const CONVERSION_FROM_STRING: Option<fn(_: &QString) -> Self>;
    fn register(name: Option<&CStr>) -> i32 { ... }
fn id() -> i32 { ... }
fn to_qvariant(&self) -> QVariant { ... }
fn from_qvariant(variant: QVariant) -> Option<Self> { ... } }

Implement this trait for type that should be known to the QMetaObject system

Once implemented for a type, it can be used as a type of a qt_property! or as a parameter of a qt_method!

#[derive(Default, Clone)]
struct MyStruct(u32, String);

impl QMetaType for MyStruct {}

Associated Constants

const CONVERSION_TO_STRING: Option<fn(_: &Self) -> QString>[src]

If this is set to a function, it enable the conversion to and from QString

const CONVERSION_FROM_STRING: Option<fn(_: &QString) -> Self>[src]

Loading content...

Provided methods

fn register(name: Option<&CStr>) -> i32[src]

Registers the type.

See the Qt documentation of qRegisterMetaType()

The default implementation should work for most types

fn id() -> i32[src]

fn to_qvariant(&self) -> QVariant[src]

Returns a QVariant containing a copy of this object

fn from_qvariant(variant: QVariant) -> Option<Self>[src]

Attempt to convert from a QVariant to this type.

Loading content...

Implementations on Foreign Types

impl QMetaType for String[src]

impl QMetaType for ()[src]

impl QMetaType for bool[src]

impl QMetaType for i32[src]

impl QMetaType for u32[src]

impl QMetaType for i64[src]

impl QMetaType for u64[src]

impl QMetaType for f64[src]

impl QMetaType for i16[src]

impl QMetaType for i8[src]

impl QMetaType for u16[src]

impl QMetaType for u8[src]

impl QMetaType for f32[src]

impl QMetaType for isize[src]

impl QMetaType for usize[src]

Loading content...

Implementors

impl QMetaType for QJSValue[src]

impl QMetaType for QByteArray[src]

impl QMetaType for QColor[src]

impl QMetaType for QDate[src]

impl QMetaType for QDateTime[src]

impl QMetaType for QImage[src]

impl QMetaType for QModelIndex[src]

impl QMetaType for QPixmap[src]

impl QMetaType for QPoint[src]

impl QMetaType for QPointF[src]

impl QMetaType for QRectF[src]

impl QMetaType for QSize[src]

impl QMetaType for QSizeF[src]

impl QMetaType for QString[src]

impl QMetaType for QTime[src]

impl QMetaType for QUrl[src]

impl QMetaType for QVariant[src]

impl QMetaType for QVariantList[src]

impl<T: QGadget> QMetaType for T where
    T: Clone + Default + 'static, 
[src]

QGadget are automatically QMetaType

Loading content...