QVariant Class Reference

#include <qvariant.h>

Class Description

Definition at line 92 of file qvariant.h.

Classes

struct  Handler
 
struct  Private
 
struct  PrivateShared
 

Public Types

enum  Type {
  Invalid = 0, Bool = 1, Int = 2, UInt = 3,
  LongLong = 4, ULongLong = 5, Double = 6, Char = 7,
  Map = 8, List = 9, String = 10, StringList = 11,
  ByteArray = 12, BitArray = 13, Date = 14, Time = 15,
  DateTime = 16, Url = 17, Locale = 18, Rect = 19,
  RectF = 20, Size = 21, SizeF = 22, Line = 23,
  LineF = 24, Point = 25, PointF = 26, RegExp = 27,
  Hash = 28, EasingCurve = 29, LastCoreType = EasingCurve, Font = 64,
  Pixmap = 65, Brush = 66, Color = 67, Palette = 68,
  Icon = 69, Image = 70, Polygon = 71, Region = 72,
  Bitmap = 73, Cursor = 74, SizePolicy = 75, KeySequence = 76,
  Pen = 77, TextLength = 78, TextFormat = 79, Matrix = 80,
  Transform = 81, Matrix4x4 = 82, Vector2D = 83, Vector3D = 84,
  Vector4D = 85, Quaternion = 86, LastGuiType = Quaternion, UserType = 127,
  LastType = 0xffffffff
}
 
typedef void(* f_construct) (Private *, const void *)
 
typedef void(* f_clear) (Private *)
 
typedef bool(* f_null) (const Private *)
 
typedef void(* f_load) (Private *, QDataStream &)
 
typedef void(* f_save) (const Private *, QDataStream &)
 
typedef bool(* f_compare) (const Private *, const Private *)
 
typedef bool(* f_convert) (const QVariant::Private *d, Type t, void *, bool *)
 
typedef bool(* f_canConvert) (const QVariant::Private *d, Type t)
 
typedef void(* f_debugStream) (QDebug, const QVariant &)
 
typedef Private DataPtr
 

Public Member Functions

 QVariant ()
 
 ~QVariant ()
 
 QVariant (Type type)
 
 QVariant (int typeOrUserType, const void *copy)
 
 QVariant (int typeOrUserType, const void *copy, uint flags)
 
 QVariant (const QVariant &other)
 
 QVariant (QDataStream &s)
 
 QVariant (int i)
 
 QVariant (uint ui)
 
 QVariant (qlonglong ll)
 
 QVariant (qulonglong ull)
 
 QVariant (bool b)
 
 QVariant (double d)
 
 QVariant (float f)
 
QT_ASCII_CAST_WARN_CONSTRUCTOR QVariant (const char *str)
 
 QVariant (const QByteArray &bytearray)
 
 QVariant (const QBitArray &bitarray)
 
 QVariant (const QString &string)
 
 QVariant (const QLatin1String &string)
 
 QVariant (const QStringList &stringlist)
 
 QVariant (const QChar &qchar)
 
 QVariant (const QDate &date)
 
 QVariant (const QTime &time)
 
 QVariant (const QDateTime &datetime)
 
 QVariant (const QList< QVariant > &list)
 
 QVariant (const QMap< QString, QVariant > &map)
 
 QVariant (const QHash< QString, QVariant > &hash)
 
 QVariant (const QSize &size)
 
 QVariant (const QSizeF &size)
 
 QVariant (const QPoint &pt)
 
 QVariant (const QPointF &pt)
 
 QVariant (const QLine &line)
 
 QVariant (const QLineF &line)
 
 QVariant (const QRect &rect)
 
 QVariant (const QRectF &rect)
 
 QVariant (const QUrl &url)
 
 QVariant (const QLocale &locale)
 
 QVariant (const QRegExp &regExp)
 
 QVariant (const QEasingCurve &easing)
 
 QVariant (Qt::GlobalColor color)
 
QVariantoperator= (const QVariant &other)
 
void swap (QVariant &other)
 
Type type () const
 
int userType () const
 
const char * typeName () const
 
bool canConvert (Type t) const
 
bool convert (Type t)
 
bool isValid () const
 
bool isNull () const
 
void clear ()
 
void detach ()
 
bool isDetached () const
 
int toInt (bool *ok=0) const
 
uint toUInt (bool *ok=0) const
 
qlonglong toLongLong (bool *ok=0) const
 
qulonglong toULongLong (bool *ok=0) const
 
bool toBool () const
 
double toDouble (bool *ok=0) const
 
float toFloat (bool *ok=0) const
 
qreal toReal (bool *ok=0) const
 
QByteArray toByteArray () const
 
QBitArray toBitArray () const
 
QString toString () const
 
QStringList toStringList () const
 
QChar toChar () const
 
QDate toDate () const
 
QTime toTime () const
 
QDateTime toDateTime () const
 
QList< QVarianttoList () const
 
QMap< QString, QVarianttoMap () const
 
QHash< QString, QVarianttoHash () const
 
QPoint toPoint () const
 
QPointF toPointF () const
 
QRect toRect () const
 
QSize toSize () const
 
QSizeF toSizeF () const
 
QLine toLine () const
 
QLineF toLineF () const
 
QRectF toRectF () const
 
QUrl toUrl () const
 
QLocale toLocale () const
 
QRegExp toRegExp () const
 
QEasingCurve toEasingCurve () const
 
void load (QDataStream &ds)
 
void save (QDataStream &ds) const
 
voiddata ()
 
const voidconstData () const
 
const voiddata () const
 
template<typename T >
void setValue (const T &value)
 
template<typename T >
value () const
 
template<typename T >
bool canConvert () const
 
bool operator== (const QVariant &v) const
 
bool operator!= (const QVariant &v) const
 
DataPtrdata_ptr ()
 

Static Public Member Functions

static const char * typeToName (Type type)
 
static Type nameToType (const char *name)
 
template<typename T >
static QVariant fromValue (const T &value)
 

Protected Member Functions

void create (int type, const void *copy)
 
bool cmp (const QVariant &other) const
 

Protected Attributes

Private d
 

Static Protected Attributes

static const Handlerhandler
 

Friends

bool qvariant_cast_helper (const QVariant &, QVariant::Type, void *)
 
int qRegisterGuiVariant ()
 
int qUnregisterGuiVariant ()
 
bool operator== (const QVariant &, const QVariantComparisonHelper &)
 
Q_CORE_EXPORT QDebug operator<< (QDebug, const QVariant &)
 

Member Typedef Documentation

typedef void(* f_construct) (Private *, const void *)

Definition at line 378 of file qvariant.h.

typedef void(* f_clear) (Private *)

Definition at line 379 of file qvariant.h.

typedef bool(* f_null) (const Private *)

Definition at line 380 of file qvariant.h.

typedef void(* f_load) (Private *, QDataStream &)

Definition at line 382 of file qvariant.h.

typedef void(* f_save) (const Private *, QDataStream &)

Definition at line 383 of file qvariant.h.

typedef bool(* f_compare) (const Private *, const Private *)

Definition at line 385 of file qvariant.h.

typedef bool(* f_convert) (const QVariant::Private *d, Type t, void *, bool *)

Definition at line 386 of file qvariant.h.

typedef bool(* f_canConvert) (const QVariant::Private *d, Type t)

Definition at line 387 of file qvariant.h.

typedef void(* f_debugStream) (QDebug, const QVariant &)

Definition at line 388 of file qvariant.h.

typedef Private DataPtr

Definition at line 439 of file qvariant.h.

Member Enumeration Documentation

enum Type
Enumerator
Invalid 
Bool 
Int 
UInt 
LongLong 
ULongLong 
Double 
Char 
Map 
List 
String 
StringList 
ByteArray 
BitArray 
Date 
Time 
DateTime 
Url 
Locale 
Rect 
RectF 
Size 
SizeF 
Line 
LineF 
Point 
PointF 
RegExp 
Hash 
EasingCurve 
LastCoreType 
Font 
Pixmap 
Brush 
Color 
Palette 
Icon 
Image 
Polygon 
Region 
Bitmap 
Cursor 
SizePolicy 
KeySequence 
Pen 
TextLength 
TextFormat 
Matrix 
Transform 
Matrix4x4 
Vector2D 
Vector3D 
Vector4D 
Quaternion 
LastGuiType 
UserType 
LastType 

Definition at line 95 of file qvariant.h.

95  {
96  Invalid = 0,
97 
98  Bool = 1,
99  Int = 2,
100  UInt = 3,
101  LongLong = 4,
102  ULongLong = 5,
103  Double = 6,
104  Char = 7,
105  Map = 8,
106  List = 9,
107  String = 10,
108  StringList = 11,
109  ByteArray = 12,
110  BitArray = 13,
111  Date = 14,
112  Time = 15,
113  DateTime = 16,
114  Url = 17,
115  Locale = 18,
116  Rect = 19,
117  RectF = 20,
118  Size = 21,
119  SizeF = 22,
120  Line = 23,
121  LineF = 24,
122  Point = 25,
123  PointF = 26,
124  RegExp = 27,
125  Hash = 28,
126  EasingCurve = 29,
128 
129  // value 62 is internally reserved
130 #ifdef QT3_SUPPORT
131  ColorGroup = 63,
132 #endif
133  Font = 64,
134  Pixmap = 65,
135  Brush = 66,
136  Color = 67,
137  Palette = 68,
138  Icon = 69,
139  Image = 70,
140  Polygon = 71,
141  Region = 72,
142  Bitmap = 73,
143  Cursor = 74,
144  SizePolicy = 75,
145  KeySequence = 76,
146  Pen = 77,
147  TextLength = 78,
148  TextFormat = 79,
149  Matrix = 80,
150  Transform = 81,
151  Matrix4x4 = 82,
152  Vector2D = 83,
153  Vector3D = 84,
154  Vector4D = 85,
155  Quaternion = 86,
157 
158  UserType = 127,
159 #ifdef QT3_SUPPORT
160  IconSet = Icon,
161  CString = ByteArray,
162  PointArray = Polygon,
163 #endif
164  LastType = 0xffffffff // need this so that gcc >= 3.4 allocates 32 bits for Type
165  };
struct _XRegion * Region
Definition: qwindowdefs.h:118

Constructor & Destructor Documentation

QVariant ( )
inline

Definition at line 484 of file qvariant.h.

484 {}
~QVariant ( )
QVariant ( Type  type)
QVariant ( int  typeOrUserType,
const void copy 
)
QVariant ( int  typeOrUserType,
const void copy,
uint  flags 
)
QVariant ( const QVariant other)
QVariant ( int  i)
QVariant ( uint  ui)
QVariant ( qulonglong  ull)
QVariant ( bool  b)
QVariant ( double  d)
QVariant ( float  f)
inline

Definition at line 184 of file qvariant.h.

184 { d.is_null = false; d.type = QMetaType::Float; d.data.f = f; }
union QVariant::Private::Data data
Private d
Definition: qvariant.h:417
GLclampf f
Definition: GLee.h:9303
QT_ASCII_CAST_WARN_CONSTRUCTOR QVariant ( const char *  str)
QVariant ( const QByteArray bytearray)
QVariant ( const QBitArray bitarray)
QVariant ( const QString string)
QVariant ( const QLatin1String string)
QVariant ( const QStringList stringlist)
QVariant ( const QChar qchar)
QVariant ( const QDate date)
QVariant ( const QTime time)
QVariant ( const QDateTime datetime)
QVariant ( const QList< QVariant > &  list)
QVariant ( const QMap< QString, QVariant > &  map)
QVariant ( const QHash< QString, QVariant > &  hash)
QVariant ( const QSize size)
QVariant ( const QSizeF size)
QVariant ( const QPoint pt)
QVariant ( const QPointF pt)
QVariant ( const QLine line)
QVariant ( const QLineF line)
QVariant ( const QRect rect)
QVariant ( const QRectF rect)
QVariant ( const QUrl url)
QVariant ( const QLocale locale)
QVariant ( const QRegExp regExp)
QVariant ( const QEasingCurve easing)

Member Function Documentation

QVariant& operator= ( const QVariant other)
void swap ( QVariant other)
inline

Definition at line 227 of file qvariant.h.

227 { qSwap(d, other.d); }
Private d
Definition: qvariant.h:417
Q_INLINE_TEMPLATE void qSwap(QScopedPointer< T, Cleanup > &p1, QScopedPointer< T, Cleanup > &p2)
Type type ( ) const
int userType ( ) const
const char* typeName ( ) const
bool canConvert ( Type  t) const
bool convert ( Type  t)
bool isValid ( ) const
inline

Definition at line 485 of file qvariant.h.

485 { return d.type != Invalid; }
Private d
Definition: qvariant.h:417
bool isNull ( ) const
void clear ( )
void detach ( )
bool isDetached ( ) const
inline

Definition at line 537 of file qvariant.h.

538 { return !d.is_shared || d.data.shared->ref == 1; }
union QVariant::Private::Data data
Private d
Definition: qvariant.h:417
PrivateShared * shared
Definition: qvariant.h:371
int toInt ( bool *  ok = 0) const
uint toUInt ( bool *  ok = 0) const
qlonglong toLongLong ( bool *  ok = 0) const
qulonglong toULongLong ( bool *  ok = 0) const
bool toBool ( ) const
double toDouble ( bool *  ok = 0) const
float toFloat ( bool *  ok = 0) const
qreal toReal ( bool *  ok = 0) const
QByteArray toByteArray ( ) const
QBitArray toBitArray ( ) const
QString toString ( ) const
QStringList toStringList ( ) const
QChar toChar ( ) const
QDate toDate ( ) const
QTime toTime ( ) const
QDateTime toDateTime ( ) const
QList<QVariant> toList ( ) const
QMap<QString, QVariant> toMap ( ) const
QHash<QString, QVariant> toHash ( ) const
QPoint toPoint ( ) const
QPointF toPointF ( ) const
QRect toRect ( ) const
QSize toSize ( ) const
QSizeF toSizeF ( ) const
QLine toLine ( ) const
QLineF toLineF ( ) const
QRectF toRectF ( ) const
QUrl toUrl ( ) const
QLocale toLocale ( ) const
QRegExp toRegExp ( ) const
QEasingCurve toEasingCurve ( ) const
void load ( QDataStream ds)
void save ( QDataStream ds) const
static const char* typeToName ( Type  type)
static
static Type nameToType ( const char *  name)
static
void* data ( )
const void* constData ( ) const
const void* data ( ) const
inline

Definition at line 326 of file qvariant.h.

326 { return constData(); }
const void * constData() const
void setValue ( const T &  value)
inline

Definition at line 527 of file qvariant.h.

528 { qVariantSetValue(*this, avalue); }
void qVariantSetValue(QVariant &v, const T &t)
Definition: qvariant.h:460
T value ( ) const
inline

Definition at line 332 of file qvariant.h.

333  { return qvariant_cast<T>(*this); }
T qvariant_cast(const QVariant &)
Definition: qvariant.h:571
static QVariant fromValue ( const T &  value)
inlinestatic

Definition at line 336 of file qvariant.h.

337  { return qVariantFromValue(value); }
QVariant qVariantFromValue(const T &)
Definition: qvariant.h:451
GLsizei const GLfloat * value
Definition: GLee.h:1742
bool canConvert ( ) const
inline

Definition at line 340 of file qvariant.h.

341  { return canConvert(Type(qMetaTypeId<T>())); }
bool canConvert() const
Definition: qvariant.h:340
bool operator== ( const QVariant v) const
inline

Definition at line 404 of file qvariant.h.

405  { return cmp(v); }
bool cmp(const QVariant &other) const
bool operator!= ( const QVariant v) const
inline

Definition at line 406 of file qvariant.h.

407  { return !cmp(v); }
bool cmp(const QVariant &other) const
void create ( int  type,
const void copy 
)
protected
bool cmp ( const QVariant other) const
protected
DataPtr& data_ptr ( )
inline

Definition at line 440 of file qvariant.h.

440 { return d; }
Private d
Definition: qvariant.h:417

Friends And Related Function Documentation

bool qvariant_cast_helper ( const QVariant v,
QVariant::Type  tp,
void ptr 
)
friend

Definition at line 447 of file qvariant.h.

448 { return QVariant::handler->convert(&v.d, tp, ptr, 0); }
Private d
Definition: qvariant.h:417
f_convert convert
Definition: qvariant.h:398
static const Handler * handler
Definition: qvariant.h:419
int qRegisterGuiVariant ( )
friend
int qUnregisterGuiVariant ( )
friend
bool operator== ( const QVariant v1,
const QVariantComparisonHelper v2 
)
friend

Definition at line 559 of file qvariant.h.

560 {
561  return v1.cmp(*v2.v);
562 }
bool cmp(const QVariant &other) const
Q_CORE_EXPORT QDebug operator<< ( QDebug  ,
const QVariant  
)
friend

Member Data Documentation

Private d
protected

Definition at line 417 of file qvariant.h.

const Handler* handler
staticprotected

Definition at line 419 of file qvariant.h.


The documentation for this class was generated from the following file: