summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/declarative/qml/qdeclarativebinding.cpp13
-rw-r--r--src/declarative/qml/qdeclarativeobjectscriptclass.cpp7
-rw-r--r--src/declarative/qml/qdeclarativescriptparser.cpp11
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml6
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp4
5 files changed, 11 insertions, 30 deletions
diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp
index 6a99855..91eb915 100644
--- a/src/declarative/qml/qdeclarativebinding.cpp
+++ b/src/declarative/qml/qdeclarativebinding.cpp
@@ -170,19 +170,6 @@ void QDeclarativeBinding::update(QDeclarativePropertyPrivate::WriteFlags flags)
if (data->error.isValid()) {
- } else if (!scriptValue.isVariant() && value.userType() == QMetaType::QVariantList &&
- data->property.propertyType() == qMetaTypeId<QVariant>()) {
-
- // This case catches QtScript's automatic conversion to QVariantList for arrays
- QUrl url = QUrl(data->url);
- int line = data->line;
- if (url.isEmpty()) url = QUrl(QLatin1String("<Unknown File>"));
-
- data->error.setUrl(url);
- data->error.setLine(line);
- data->error.setColumn(-1);
- data->error.setDescription(QLatin1String("Unable to assign JavaScript array to QML variant property"));
-
} else if (isUndefined && data->property.isResettable()) {
data->property.reset();
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());
diff --git a/src/declarative/qml/qdeclarativescriptparser.cpp b/src/declarative/qml/qdeclarativescriptparser.cpp
index 507ff5b..92a10aa 100644
--- a/src/declarative/qml/qdeclarativescriptparser.cpp
+++ b/src/declarative/qml/qdeclarativescriptparser.cpp
@@ -535,7 +535,8 @@ bool ProcessAST::visit(AST::UiPublicMember *node)
// { "time", Object::DynamicProperty::Time, "QTime" },
// { "date", Object::DynamicProperty::Date, "QDate" },
{ "date", Object::DynamicProperty::DateTime, "QDateTime" },
- { "var", Object::DynamicProperty::Variant, "QVariant" }
+ { "var", Object::DynamicProperty::Variant, "QVariant" },
+ { "variant", Object::DynamicProperty::Variant, "QVariant" }
};
const int propTypeNameToTypesCount = sizeof(propTypeNameToTypes) /
sizeof(propTypeNameToTypes[0]);
@@ -563,7 +564,7 @@ bool ProcessAST::visit(AST::UiPublicMember *node)
_parser->_errors << error;
return false;
}
-
+
signal.parameterTypes << qtType;
signal.parameterNames << p->name->asString().toUtf8();
p = p->finish();
@@ -646,6 +647,11 @@ bool ProcessAST::visit(AST::UiPublicMember *node)
property.location = location(node->firstSourceLocation(),
node->lastSourceLocation());
+ if (memberType == QByteArray("var"))
+ qWarning().nospace() << qPrintable(_parser->_scriptFile) << ":" << property.location.start.line << ":"
+ << property.location.start.column << ": var type has been replaced by variant. "
+ << "Support will be removed entirely shortly.";
+
if (node->expression) { // default value
property.defaultValue = new Property;
property.defaultValue->parent = _stateStack.top().object;
@@ -909,6 +915,7 @@ bool QDeclarativeScriptParser::parse(const QByteArray &qmldata, const QUrl &url)
clear();
const QString fileName = url.toString();
+ _scriptFile = fileName;
QTextStream stream(qmldata, QIODevice::ReadOnly);
stream.setCodec("UTF-8");
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml b/tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml
index 483179a..416dbce 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml
@@ -14,12 +14,6 @@ QtObject {
}
try {
- root.b = [ 10, root ]
- } catch(e) {
- console.log (e.fileName + ":" + e.lineNumber + ":" + e);
- }
-
- try {
root.a = "Hello";
} catch(e) {
console.log (e.fileName + ":" + e.lineNumber + ":" + e);
diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
index 72f14f9..c6bb276 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
+++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
@@ -1026,12 +1026,10 @@ void tst_qdeclarativeecmascript::propertyAssignmentErrors()
QString url = component.url().toString();
QString warning1 = url + ":11:Error: Cannot assign [undefined] to int";
- QString warning2 = url + ":17:Error: Cannot assign JavaScript array to QML variant property";
- QString warning3 = url + ":23:Error: Cannot assign QString to int";
+ QString warning2 = url + ":17:Error: Cannot assign QString to int";
QTest::ignoreMessage(QtDebugMsg, warning1.toLatin1().constData());
QTest::ignoreMessage(QtDebugMsg, warning2.toLatin1().constData());
- QTest::ignoreMessage(QtDebugMsg, warning3.toLatin1().constData());
QObject *object = component.create();
QVERIFY(object != 0);