QVariant 类,类似于C++的联合数据类型,他能保存很多Qt数据。
声明:
v= QVarient ("hello world");
QString string=v.toString();
先声明,然后调用相关的函数就行了。
它好多可供转化的函数:
QVariant () | |
QVariant ( const QLocale & l ) | |
QVariant ( const QRegExp & regExp ) | |
QVariant ( const QEasingCurve & val ) | |
QVariant ( Qt::GlobalColor color ) | |
QVariant ( Type type ) | |
QVariant ( int typeOrUserType, const void * copy ) | |
QVariant ( const QVariant & p ) | |
QVariant ( QDataStream & s ) | |
QVariant ( int val ) | |
QVariant ( uint val ) | |
QVariant ( qlonglong val ) | |
QVariant ( qulonglong val ) | |
QVariant ( bool val ) | |
QVariant ( double val ) | |
QVariant ( float val ) | |
QVariant ( const char * val ) | |
QVariant ( const QByteArray & val ) | |
QVariant ( const QBitArray & val ) | |
QVariant ( const QString & val ) | |
QVariant ( const QLatin1String & val ) | |
QVariant ( const QStringList & val ) | |
QVariant ( const QChar & c ) | |
QVariant ( const QDate & val ) | |
QVariant ( const QTime & val ) | |
QVariant ( const QDateTime & val ) | |
QVariant ( const QList<QVariant> & val ) | |
QVariant ( const QMap<QString, QVariant> & val ) | |
QVariant ( const QHash<QString, QVariant> & val ) | |
QVariant ( const QSize & val ) | |
QVariant ( const QSizeF & val ) | |
QVariant ( const QPoint & val ) | |
QVariant ( const QPointF & val ) | |
QVariant ( const QLine & val ) | |
QVariant ( const QLineF & val ) | |
QVariant ( const QRect & val ) | |
QVariant ( const QRectF & val ) | |
QVariant ( const QUrl & val ) | |
~QVariant () | |
bool | canConvert ( Type t ) const |
bool | canConvert () const |
void | clear () |
bool | convert ( Type t ) |
bool | isNull () const |
bool | isValid () const |
void | setValue ( const T & value ) |
void | swap ( QVariant & other ) |
QBitArray | toBitArray () const |
bool | toBool () const |
QByteArray | toByteArray () const |
QChar | toChar () const |
QDate | toDate () const |
QDateTime | toDateTime () const |
double | toDouble ( bool * ok = 0 ) const |
QEasingCurve | toEasingCurve () const |
float | toFloat ( bool * ok = 0 ) const |
QHash<QString, QVariant> | toHash () const |
int | toInt ( bool * ok = 0 ) const |
QLine | toLine () const |
QLineF | toLineF () const |
QList<QVariant> | toList () const |
QLocale | toLocale () const |
qlonglong | toLongLong ( bool * ok = 0 ) const |
QMap<QString, QVariant> | toMap () const |
QPoint | toPoint () const |
QPointF | toPointF () const |
qreal | toReal ( bool * ok = 0 ) const |
QRect | toRect () const |
QRectF | toRectF () const |
QRegExp | toRegExp () const |
QSize | toSize () const |
QSizeF | toSizeF () const |
QString | toString () const |
QStringList | toStringList () const |
QTime | toTime () const |
uint | toUInt ( bool * ok = 0 ) const |
qulonglong | toULongLong ( bool * ok = 0 ) const |
QUrl | toUrl () const |
Type | type () const |
const char * | typeName () const |
int | userType () const |
T | value () const |
bool | operator!= ( const QVariant & v ) const |
QVariant & | operator= ( const QVariant & variant ) |
bool | operator== ( const QVariant & v ) const |