diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-04-09 03:31:25 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-04-09 03:33:39 (GMT) |
commit | 45ca7aff2c04c302906a1af0d9d671bb9cb452f0 (patch) | |
tree | 3d486beafbe66ec7fe0b6451abec652211c1328d /src/declarative/qml/qdeclarativeobjectscriptclass.cpp | |
parent | 25f17fb8e566fca0838545941d3e0281698ec355 (diff) | |
download | Qt-45ca7aff2c04c302906a1af0d9d671bb9cb452f0.zip Qt-45ca7aff2c04c302906a1af0d9d671bb9cb452f0.tar.gz Qt-45ca7aff2c04c302906a1af0d9d671bb9cb452f0.tar.bz2 |
Use variant instead of var in QML
In QML "var"s are not the same as JavaScript vars - they are QVariants
instead. However, as they behave in a similar enough fashion to native
JavaScript it can be confusing to developers when they are called "var".
Diffstat (limited to 'src/declarative/qml/qdeclarativeobjectscriptclass.cpp')
-rw-r--r-- | src/declarative/qml/qdeclarativeobjectscriptclass.cpp | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp index ec84da9..4601aaa 100644 --- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp +++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp @@ -361,12 +361,7 @@ void QDeclarativeObjectScriptClass::setProperty(QObject *obj, else v = enginePriv->scriptValueToVariant(value, lastData->propType); - if (!value.isVariant() && v.userType() == QMetaType::QVariantList && - lastData->propType == qMetaTypeId<QVariant>()) { - - QString error = QLatin1String("Cannot assign JavaScript array to QML variant property"); - context->throwError(error); - } else if (!QDeclarativePropertyPrivate::write(obj, *lastData, v, evalContext)) { + if (!QDeclarativePropertyPrivate::write(obj, *lastData, v, evalContext)) { const char *valueType = 0; if (v.userType() == QVariant::Invalid) valueType = "null"; else valueType = QMetaType::typeName(v.userType()); |