6#include <private/qqmlvaluetypewrapper_p.h>
7#include <private/qv4qobjectwrapper_p.h>
26 removeVmePropertyReference();
29bool VariantObject::Data::isScarce()
const
31 int t =
data().userType();
32 return t == QMetaType::QPixmap ||
t == QMetaType::QImage;
41 return lv->d()->data() == rv->d()->data();
44 return v->isEqual(lv->d()->data());
55 d()->addVmePropertyReference();
65 d()->removeVmePropertyReference();
72 defineDefaultProperty(
QStringLiteral(
"preserve"), method_preserve, 0);
73 defineDefaultProperty(
QStringLiteral(
"destroy"), method_destroy, 0);
74 defineDefaultProperty(
engine()->id_valueOf(), method_valueOf, 0);
75 defineDefaultProperty(
engine()->id_toString(), method_toString, 0);
81 if (
o &&
o->d()->isScarce())
82 o->d()->addVmePropertyReference();
90 if (
o->d()->isScarce())
91 o->d()->addVmePropertyReference();
120 switch (
v.userType()) {
123 case QMetaType::QString:
124 return Encode(
b->engine()->newString(
v.toString()));
127 case QMetaType::Double:
128 case QMetaType::UInt:
130 case QMetaType::Bool:
134 if (
v.metaType().sizeOf() <=
qsizetype(
sizeof(
int)))
136 if (
v.canConvert<
double>())
138 if (
v.canConvert<
int>())
140 if (
v.canConvert<
uint>())
142 if (
v.canConvert<
bool>())
145 return Encode(
b->engine()->newString(
v.toString()));
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString toString() const
Returns the variant as a QString if the variant has a userType() including, but not limited to:
bool canConvert(QMetaType targetType) const
Combined button and popup list for selecting options.
\qmltype Particle \inqmlmodule QtQuick.Particles
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * v
[13]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
#define QStringLiteral(str)
#define RETURN_UNDEFINED()
#define DEFINE_OBJECT_VTABLE(classname)
static constexpr ReturnedValue undefined()
Heap::String * newString(const QString &s=QString())
void removeVmePropertyReference()
void addVmePropertyReference()
int vmePropertyReferenceCount
constexpr ReturnedValue asReturnedValue() const
static constexpr VTable::IsEqualTo virtualIsEqualTo
static ReturnedValue method_destroy(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_valueOf(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_preserve(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_toString(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)