aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/v8/qv8engine.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2014-11-10 11:39:03 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2014-12-22 21:48:11 +0100
commitfa3cf15e0577fe382ac577456422ad78325a3977 (patch)
tree3323ab526433f73fb644b1692c10629f01093d62 /src/qml/qml/v8/qv8engine.cpp
parentee771dda2e9e304edea88e6d5f6e6d540a0bab97 (diff)
Initial work on gadget support
Changed built-in QtQml value types to use gadgets. This is in preparation for supporting external gadgets. This replaces the mostly direct inheritance of the concrete value types with gadgets and "dynamic" inheritance through QQmlValueType being generic. Over time as some of the value types may become gadgets, we can remove the ones here. It's important that these "separate" gadgets have the same memory layout as the actual types (QPointF, etc.). Also while QQmlValueType remains practically a singleton, it's not required anymore to be one. Consequently the JS wrappers for value types keep their own instance of QQmlValueType. This allows eliminating the qobject_cast in various places that dealt with the singleton nature. This comes at a cost, making the JS wrappers slightly heavier. However that is meant to be a temporary situation and finally the value type wrapper should merely store the meta-object in addition to the data and the type. Change-Id: I15071ded0a1e54203f29ec1ecf7a9ab646d1168e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/qml/v8/qv8engine.cpp')
-rw-r--r--src/qml/qml/v8/qv8engine.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp
index 5e9e20b416..ee124aeed0 100644
--- a/src/qml/qml/v8/qv8engine.cpp
+++ b/src/qml/qml/v8/qv8engine.cpp
@@ -413,8 +413,8 @@ QV4::ReturnedValue QV8Engine::fromVariant(const QVariant &variant)
break;
}
- if (QQmlValueType *vt = QQmlValueTypeFactory::valueType(type))
- return QV4::QmlValueTypeWrapper::create(this, variant, vt);
+ if (const QMetaObject *vtmo = QQmlValueTypeFactory::metaObjectForMetaType(type))
+ return QV4::QmlValueTypeWrapper::create(this, variant, vtmo, type);
} else {
QV4::Scope scope(m_v4Engine);
if (type == qMetaTypeId<QQmlListReference>()) {
@@ -454,8 +454,8 @@ QV4::ReturnedValue QV8Engine::fromVariant(const QVariant &variant)
if (succeeded)
return retn.asReturnedValue();
- if (QQmlValueType *vt = QQmlValueTypeFactory::valueType(type))
- return QV4::QmlValueTypeWrapper::create(this, variant, vt);
+ if (const QMetaObject *vtmo = QQmlValueTypeFactory::metaObjectForMetaType(type))
+ return QV4::QmlValueTypeWrapper::create(this, variant, vtmo, type);
}
// XXX TODO: To be compatible, we still need to handle: