diff options
Diffstat (limited to 'src/qml/qml/qqmlvmemetaobject_p.h')
-rw-r--r-- | src/qml/qml/qqmlvmemetaobject_p.h | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/qml/qml/qqmlvmemetaobject_p.h b/src/qml/qml/qqmlvmemetaobject_p.h index dbcc9d2884..35bc35ce4b 100644 --- a/src/qml/qml/qqmlvmemetaobject_p.h +++ b/src/qml/qml/qqmlvmemetaobject_p.h @@ -196,12 +196,18 @@ public: 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 writeProperty(int id, const QDate& v); - void writeProperty(int id, const QDateTime& v); - void writeProperty(int id, const QRectF& v); + + template<typename VariantCompatible> + void writeProperty(int id, const VariantCompatible &v) + { + QV4::MemberData *md = propertyAndMethodStorageAsMemberData(); + if (md) { + QV4::Scope scope(engine); + QV4::Scoped<QV4::MemberData>(scope, md)->set(engine, id, engine->newVariantObject( + QVariant::fromValue(v))); + } + } + void writeProperty(int id, QObject *v); void ensureQObjectWrapper(); |