Qt Reference Documentation

Obsolete Members for QVariant

The following class members are obsolete. They are provided to keep old source code working. We strongly advise against using them in new code.

Related Non-Members

QVariant qVariantFromValue ( const T & value ) (obsolete)
void qVariantSetValue ( QVariant & variant, const T & value ) (obsolete)

Related Non-Members

QVariant qVariantFromValue ( const T & value )

Returns a variant containing a copy of the given value with template type T.

This function is equivalent to QVariant::fromValue(value).

Note: This function was provided as a workaround for MSVC 6 which did not support member template functions. It is advised to use the other form in new code.

For example, a QObject pointer can be stored in a variant with the following code:

 QObject *object = getObjectFromSomewhere();
 QVariant data = QVariant::fromValue(object);

See also QVariant::fromValue().

void qVariantSetValue ( QVariant & variant, const T & value )

Sets the contents of the given variant to a copy of the value with the specified template type T.

This function is equivalent to QVariant::setValue(value).

Note: This function was provided as a workaround for MSVC 6 which did not support member template functions. It is advised to use the other form in new code.

See also QVariant::setValue().