127 LastCoreType = EasingCurve,
156 LastGuiType = Quaternion,
162 PointArray = Polygon,
164 LastType = 0xffffffff
170 QVariant(
int typeOrUserType,
const void *copy);
171 QVariant(
int typeOrUserType,
const void *copy, uint flags);
174 #ifndef QT_NO_DATASTREAM
185 #ifndef QT_NO_CAST_FROM_ASCII
186 QT_ASCII_CAST_WARN_CONSTRUCTOR
QVariant(
const char *str);
190 QVariant(
const QBitArray &bitarray);
193 QVariant(
const QStringList &stringlist);
197 QVariant(
const QDateTime &datetime);
201 #ifndef QT_NO_GEOM_VARIANT
216 #ifndef QT_BOOTSTRAPPED
217 QVariant(
const QEasingCurve &easing);
222 #ifdef Q_COMPILER_RVALUE_REFS
224 {
qSwap(d, other.d);
return *
this; }
230 int userType()
const;
231 const char *typeName()
const;
233 bool canConvert(Type
t)
const;
234 bool convert(Type
t);
237 inline QT3_SUPPORT
bool canCast(Type
t)
const
238 {
return canConvert(t); }
239 inline QT3_SUPPORT
bool cast(Type
t)
240 {
return convert(t); }
243 inline bool isValid()
const;
249 inline bool isDetached()
const;
251 int toInt(
bool *ok = 0)
const;
252 uint toUInt(
bool *ok = 0)
const;
253 qlonglong toLongLong(
bool *ok = 0)
const;
256 double toDouble(
bool *ok = 0)
const;
257 float toFloat(
bool *ok = 0)
const;
258 qreal toReal(
bool *ok = 0)
const;
260 QBitArray toBitArray()
const;
262 QStringList toStringList()
const;
263 QChar toChar()
const;
264 QDate toDate()
const;
265 QTime toTime()
const;
266 QDateTime toDateTime()
const;
271 #ifndef QT_NO_GEOM_VARIANT
272 QPoint toPoint()
const;
273 QPointF toPointF()
const;
274 QRect toRect()
const;
275 QSize toSize()
const;
276 QSizeF toSizeF()
const;
277 QLine toLine()
const;
278 QLineF toLineF()
const;
279 QRectF toRectF()
const;
282 QLocale toLocale()
const;
286 #ifndef QT_BOOTSTRAPPED
287 QEasingCurve toEasingCurve()
const;
291 inline QT3_SUPPORT
int &asInt();
292 inline QT3_SUPPORT uint &asUInt();
293 inline QT3_SUPPORT
qlonglong &asLongLong();
295 inline QT3_SUPPORT
bool &asBool();
296 inline QT3_SUPPORT
double &asDouble();
298 inline QT3_SUPPORT QBitArray &asBitArray();
299 inline QT3_SUPPORT
QString &asString();
300 inline QT3_SUPPORT QStringList &asStringList();
301 inline QT3_SUPPORT QDate &asDate();
302 inline QT3_SUPPORT QTime &asTime();
303 inline QT3_SUPPORT QDateTime &asDateTime();
306 inline QT3_SUPPORT QPoint &asPoint();
307 inline QT3_SUPPORT QRect &asRect();
308 inline QT3_SUPPORT QSize &asSize();
311 #ifndef QT_NO_DATASTREAM
312 void load(QDataStream &ds);
313 void save(QDataStream &ds)
const;
315 static const char *typeToName(Type
type);
316 static Type nameToType(
const char *
name);
319 inline QT3_SUPPORT_CONSTRUCTOR
QVariant(
bool val,
int) { create(
Bool, &val); }
320 inline QT3_SUPPORT
const QByteArray toCString()
const {
return toByteArray(); }
321 inline QT3_SUPPORT
QByteArray &asCString() {
return *
reinterpret_cast<QByteArray *
>(castOrDetach(ByteArray)); }
325 const void *constData()
const;
326 inline const void *
data()
const {
return constData(); }
329 inline void setValue(
const T &
value);
341 {
return canConvert(
Type(qMetaTypeId<T>())); }
356 is_shared(other.is_shared), is_null(other.is_null)
379 typedef void (*f_clear)(Private *);
380 typedef bool (*f_null)(
const Private *);
381 #ifndef QT_NO_DATASTREAM
382 typedef void (*f_load)(Private *, QDataStream &);
383 typedef void (*f_save)(
const Private *, QDataStream &);
385 typedef bool (*f_compare)(
const Private *,
const Private *);
393 #ifndef QT_NO_DATASTREAM
411 friend int qRegisterGuiVariant();
412 friend int qUnregisterGuiVariant();
414 #ifndef QT_NO_DEBUG_STREAM
421 void create(
int type,
const void *copy);
423 void *castOrDetach(
Type t);
425 bool cmp(
const QVariant &other)
const;
429 inline QVariant(
void *) { Q_ASSERT(
false); }
430 #ifdef QT_NO_CAST_FROM_ASCII
432 inline QVariant(
const char *) { Q_ASSERT(
false); }
436 inline QVariant(
bool,
int) { Q_ASSERT(
false); }
450 template <
typename T>
453 return QVariant(qMetaTypeId<T>(reinterpret_cast<T *>(0)), &t, QTypeInfo<T>::isPointer);
459 template <
typename T>
463 const uint
type = qMetaTypeId<T>(
reinterpret_cast<T *
>(0));
469 if (QTypeInfo<T>::isComplex)
473 v =
QVariant(type, &t, QTypeInfo<T>::isPointer);
488 inline int &QVariant::asInt()
489 {
return *
reinterpret_cast<int *
>(castOrDetach(
Int)); }
490 inline uint &QVariant::asUInt()
491 {
return *
reinterpret_cast<uint *
>(castOrDetach(
UInt)); }
496 inline bool &QVariant::asBool()
497 {
return *
reinterpret_cast<bool *
>(castOrDetach(
Bool)); }
498 inline double &QVariant::asDouble()
499 {
return *
reinterpret_cast<double *
>(castOrDetach(
Double)); }
502 inline QBitArray& QVariant::asBitArray()
503 {
return *
reinterpret_cast<QBitArray *
>(castOrDetach(
BitArray)); }
504 inline QString& QVariant::asString()
505 {
return *
reinterpret_cast<QString *
>(castOrDetach(
String)); }
506 inline QStringList& QVariant::asStringList()
507 {
return *
reinterpret_cast<QStringList *
>(castOrDetach(
StringList)); }
508 inline QDate& QVariant::asDate()
509 {
return *
reinterpret_cast<QDate *
>(castOrDetach(
Date)); }
510 inline QTime& QVariant::asTime()
511 {
return *
reinterpret_cast<QTime *
>(castOrDetach(
Time)); }
512 inline QDateTime& QVariant::asDateTime()
513 {
return *
reinterpret_cast<QDateTime *
>(castOrDetach(
DateTime)); }
518 inline QPoint &QVariant::asPoint()
519 {
return *
reinterpret_cast<QPoint *
>(castOrDetach(
Point)); }
520 inline QRect &QVariant::asRect()
521 {
return *
reinterpret_cast<QRect *
>(castOrDetach(
Rect)); }
522 inline QSize &QVariant::asSize()
523 {
return *
reinterpret_cast<QSize *
>(castOrDetach(
Size)); }
530 #ifndef QT_NO_DATASTREAM
561 return v1.
cmp(*v2.v);
573 const int vid = qMetaTypeId<T>(
static_cast<T *
>(0));
575 return *reinterpret_cast<const T *>(v.
constData());
587 return *reinterpret_cast<const QVariant *>(v.constData());
593 inline QT_DEPRECATED T qVariantValue(
const QVariant &variant)
597 inline QT_DEPRECATED
bool qVariantCanConvert(
const QVariant &variant)
598 {
return variant.template canConvert<T>(); }
605 #ifndef QT_NO_DEBUG_STREAM
GLuint GLuint GLsizei GLenum type
union QVariant::Private::Data data
QHash< QString, QVariant > QVariantHash
void setValue(const T &value)
QVariant qVariantFromValue(const T &)
Q_CORE_EXPORT QDataStream & operator<<(QDataStream &s, const QVariant &p)
QFuture< void > map(Sequence &sequence, MapFunctor map)
GLfloat GLfloat GLfloat v2
bool operator!=(const QVariant &v1, const QVariantComparisonHelper &v2)
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
QMap< QString, QVariant > QVariantMap
const void * constData() const
Q_DECLARE_TYPEINFO(QVariant, Q_MOVABLE_TYPE)
Q_CORE_EXPORT QDataStream & operator>>(QDataStream &s, QVariant &p)
bool operator==(const QVariant &v1, const QVariantComparisonHelper &v2)
#define QT_BEGIN_NAMESPACE
void qVariantSetValue< QVariant >(QVariant &v, const QVariant &t)
GLsizei GLsizei GLenum GLenum const GLvoid * data
f_debugStream debugStream
Private(const Private &other)
Q_INLINE_TEMPLATE void qSwap(QScopedPointer< T, Cleanup > &p1, QScopedPointer< T, Cleanup > &p2)
bool operator!=(const QVariant &v) const
const void * data() const
void qVariantSetValue(QVariant &v, const T &t)
QVariantComparisonHelper(const QVariant &var)
typedef Bool(APIENTRYP PFNGLXMAKECONTEXTCURRENTPROC)(Display *dpy
bool qvariant_cast_helper(const QVariant &v, QVariant::Type tp, void *ptr)
GLsizei const GLfloat * value
GLuint const GLchar * name
QList< QVariant > QVariantList
T qvariant_cast(const QVariant &)
friend bool operator==(const QVariant &, const QVariantComparisonHelper &)
void swap(QVariant &other)
static const Handler * handler
bool cmp(const QVariant &other) const
bool operator==(const QVariant &v) const
static QVariant fromValue(const T &value)