vp->putIndexed(id, s);
}
+void QQmlVMEMetaObject::writeProperty(int id, const QUrl& v)
+{
+ if (!ensurePropertiesAllocated())
+ return;
+
+ QV4::Scope scope(properties.engine());
+ QV4::ScopedObject vp(scope, properties.value());
+ QV4::ScopedValue sv(scope, properties.engine()->newVariantObject(QVariant::fromValue(v)));
+ vp->putIndexed(id, sv);
+}
+
+void QQmlVMEMetaObject::writeProperty(int id, const QPointF& v)
+{
+ if (!ensurePropertiesAllocated())
+ return;
+
+ QV4::Scope scope(properties.engine());
+ QV4::ScopedObject vp(scope, properties.value());
+ QV4::ScopedValue sv(scope, properties.engine()->newVariantObject(QVariant::fromValue(v)));
+ vp->putIndexed(id, sv);
+}
+
void QQmlVMEMetaObject::writeProperty(int id, const QSizeF& v)
{
if (!ensurePropertiesAllocated())
return sv->stringValue()->toQString();
}
+QUrl QQmlVMEMetaObject::readPropertyAsUrl(int id)
+{
+ if (!ensurePropertiesAllocated())
+ return QUrl();
+
+ QV4::Scope scope(properties.engine());
+ QV4::ScopedObject vp(scope, properties.value());
+ QV4::ScopedValue sv(scope, vp->getIndexed(id));
+ const QV4::VariantObject *v = sv->as<QV4::VariantObject>();
+ if (!v || v->d()->data.type() != QVariant::Url) {
+ writeProperty(id, QUrl());
+ return QUrl();
+ }
+ return v->d()->data.value<QUrl>();
+}
+
QSizeF QQmlVMEMetaObject::readPropertyAsSizeF(int id)
{
if (!ensurePropertiesAllocated())
return v->d()->data.value<QSizeF>();
}
+QPointF QQmlVMEMetaObject::readPropertyAsPointF(int id)
+{
+ if (!ensurePropertiesAllocated())
+ return QPointF();
+
+ QV4::Scope scope(properties.engine());
+ QV4::ScopedObject vp(scope, properties.value());
+ QV4::ScopedValue sv(scope, vp->getIndexed(id));
+ const QV4::VariantObject *v = sv->as<QV4::VariantObject>();
+ if (!v || v->d()->data.type() != QVariant::PointF) {
+ writeProperty(id, QPointF());
+ return QPointF();
+ }
+ return v->d()->data.value<QPointF>();
+}
+
+
int QQmlVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a)
{
int id = _id;
*reinterpret_cast<QString *>(a[0]) = readPropertyAsString(id);
break;
case QVariant::Url:
- *reinterpret_cast<QUrl *>(a[0]) = data[id].asQUrl();
+ *reinterpret_cast<QUrl *>(a[0]) = readPropertyAsUrl(id);
break;
case QVariant::Date:
*reinterpret_cast<QDate *>(a[0]) = data[id].asQDate();
*reinterpret_cast<QSizeF *>(a[0]) = readPropertyAsSizeF(id);
break;
case QVariant::PointF:
- *reinterpret_cast<QPointF *>(a[0]) = data[id].asQPointF();
+ *reinterpret_cast<QPointF *>(a[0]) = readPropertyAsPointF(id);
break;
case QMetaType::QObjectStar:
*reinterpret_cast<QObject **>(a[0]) = data[id].asQObject();
writeProperty(id, *reinterpret_cast<QString *>(a[0]));
break;
case QVariant::Url:
- needActivate = *reinterpret_cast<QUrl *>(a[0]) != data[id].asQUrl();
- data[id].setValue(*reinterpret_cast<QUrl *>(a[0]));
+ needActivate = *reinterpret_cast<QUrl *>(a[0]) != readPropertyAsUrl(id);
+ writeProperty(id, *reinterpret_cast<QUrl *>(a[0]));
break;
case QVariant::Date:
needActivate = *reinterpret_cast<QDate *>(a[0]) != data[id].asQDate();
writeProperty(id, *reinterpret_cast<QSizeF *>(a[0]));
break;
case QVariant::PointF:
- needActivate = *reinterpret_cast<QPointF *>(a[0]) != data[id].asQPointF();
- data[id].setValue(*reinterpret_cast<QPointF *>(a[0]));
+ needActivate = *reinterpret_cast<QPointF *>(a[0]) != readPropertyAsPointF(id);
+ writeProperty(id, *reinterpret_cast<QPointF *>(a[0]));
break;
case QMetaType::QObjectStar:
needActivate = *reinterpret_cast<QObject **>(a[0]) != data[id].asQObject();
double readPropertyAsDouble(int id);
QString readPropertyAsString(int id);
QSizeF readPropertyAsSizeF(int id);
+ QPointF readPropertyAsPointF(int id);
+ QUrl readPropertyAsUrl(int id);
void writeProperty(int id, int v);
void writeProperty(int id, bool v);
void writeProperty(int id, double v);
void writeProperty(int id, const QString& v);
+ void writeProperty(int id, const QPointF& v);
void writeProperty(int id, const QSizeF& v);
+ void writeProperty(int id, const QUrl& v);
void ensureQObjectWrapper();