Logo Search packages:      
Sourcecode: qt4-x11 version File versions  Download package

T qvariant_cast ( const QVariant value  )  [related]

Returns the given value converted to the template type {T}.

This function is equivalent to qVariantValue().

See also:
qVariantValue(), QVariant::value()

Definition at line 533 of file qvariant.h.

References constData(), and userType().

    const int vid = qMetaTypeId<T>(static_cast<T *>(0));
    if (vid == v.userType())
        return *reinterpret_cast<const T *>(v.constData());
    if (vid < int(QMetaType::User)) {
        T t;
        qvariant_cast_helper(v, QVariant::Type(vid), &t);
        return t;
    return T();

Generated by  Doxygen 1.6.0   Back to index