Obsolete Members for QVariant

以下成员源于类 QVariant 已过时。 提供它们是为使旧源代码能继续工作。强烈建议不要在新代码中使用它们。

公共类型

(obsolete) enum Type { Invalid, BitArray, Bitmap, Bool, ..., UserType }

相关非成员

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

相关非成员

bool qVariantCanConvert (const QVariant & value )

此函数已过时。提供它是为使旧源代码能继续工作。强烈建议不要在新代码中使用它。

返回 true 若给定 value can be converted to the template type specified; otherwise returns false .

此函数相当于 QVariant::canConvert ( value ).

注意: 此函数是为不支持成员模板函数的 MSVC 6 提供的解决方案。建议在新代码中使用其它形式。

另请参阅 QVariant::canConvert ().

QVariant qVariantFromValue (const T & value )

此函数已过时。提供它是为使旧源代码能继续工作。强烈建议不要在新代码中使用它。

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

此函数相当于 QVariant::fromValue ( value ).

注意: 此函数是为不支持成员模板函数的 MSVC 6 提供的解决方案。建议在新代码中使用其它形式。

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

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

另请参阅 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 .

此函数相当于 QVariant::setValue ( value ).

注意: 此函数是为不支持成员模板函数的 MSVC 6 提供的解决方案。建议在新代码中使用其它形式。

另请参阅 QVariant::setValue ().

T qVariantValue (const QVariant & value )

此函数已过时。提供它是为使旧源代码能继续工作。强烈建议不要在新代码中使用它。

返回给定 value 被转换成模板类型 T .

此函数相当于 QVariant::value <T>( value ).

注意: 此函数是为不支持成员模板函数的 MSVC 6 提供的解决方案。建议在新代码中使用其它形式。

另请参阅 QVariant::value () 和 qvariant_cast ().