Qt Reference Documentation

# Qt 3 Support Members for QVariant

The following class members are part of the Qt 3 support layer. They are provided to help you port old code to Qt 4. We advise against using them in new code.

- QVariant class reference

## Public Functions

| QVariant ( bool b, int dummy )
QBitArray & | asBitArray ()
bool & | asBool ()
QByteArray & | asByteArray ()
QByteArray & | asCString ()
QDate & | asDate ()
QDateTime & | asDateTime ()
double & | asDouble ()
int & | asInt ()
QList<QVariant> & | asList ()
qlonglong & | asLongLong ()
QMap<QString, QVariant> & | asMap ()
QPoint & | asPoint ()
QRect & | asRect ()
QSize & | asSize ()
QString & | asString ()
QStringList & | asStringList ()
QTime & | asTime ()
uint & | asUInt ()
qulonglong & | asULongLong ()
bool | canCast ( Type t ) const
bool | cast ( Type t )
const QByteArray | toCString () const

## Related Non-Members

bool | qVariantCanConvert ( const QVariant & value )
T | qVariantValue ( const QVariant & value )

## Member Function Documentation

### QVariant::QVariant ( bool b, int dummy )

Use the QVariant(bool) constructor instead.

### QBitArray & QVariant::asBitArray ()

Use toBitArray() instead.

### bool & QVariant::asBool ()

Use toBool() instead.

### QByteArray & QVariant::asByteArray ()

Use toByteArray() instead.

### QByteArray & QVariant::asCString ()

Use toByteArray() instead.

### QDate & QVariant::asDate ()

Use toDate() instead.

### QDateTime & QVariant::asDateTime ()

Use toDateTime() instead.

### double & QVariant::asDouble ()

Use toDouble() instead.

### int & QVariant::asInt ()

Use toInt() instead.

### QList<QVariant> & QVariant::asList ()

Use toList() instead.

### qlonglong & QVariant::asLongLong ()

Use toLongLong() instead.

### QMap<QString, QVariant> & QVariant::asMap ()

Use toMap() instead.

### QPoint & QVariant::asPoint ()

Use toPoint() instead.

### QRect & QVariant::asRect ()

Use toRect() instead.

### QSize & QVariant::asSize ()

Use toSize() instead.

### QString & QVariant::asString ()

Use toString() instead.

### QStringList & QVariant::asStringList ()

Use toStringList() instead.

### QTime & QVariant::asTime ()

Use toTime() instead.

### uint & QVariant::asUInt ()

Use toUInt() instead.

### qulonglong & QVariant::asULongLong ()

Use toULongLong() instead.

### bool QVariant::canCast ( Type t ) const

Use canConvert() instead.

### bool QVariant::cast ( Type t )

Use convert() instead.

### const QByteArray QVariant::toCString () const

Use toByteArray() instead.

## Related Non-Members

### bool qVariantCanConvert ( const QVariant & value )

Returns true if the given value can be converted to the template type specified; otherwise returns false.

This function is equivalent to QVariant::canConvert(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::canConvert().

### T qVariantValue ( const QVariant & value )

Returns the given value converted to the template type `T`.

This function is equivalent to QVariant::value<T>(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::value() and qvariant_cast().