diff options
author | Rainer Keller <Rainer.Keller@qt.io> | 2019-04-17 12:41:10 +0200 |
---|---|---|
committer | Rainer Keller <Rainer.Keller@qt.io> | 2019-04-17 10:51:42 +0000 |
commit | 2bdbf216fe7b6cf9d404b80ac405bd3969f5c07f (patch) | |
tree | 7f92f281d5e2a9edca5dd44ef35cbcc562c580ca /src/qml/compiler | |
parent | 761d23806633cb32613f2ddf11711b3a71650eb1 (diff) |
Improve error message
Change-Id: I1f7f0781521757f5412b50680203698e33bd9d23
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/compiler')
-rw-r--r-- | src/qml/compiler/qqmlpropertyvalidator.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/qml/compiler/qqmlpropertyvalidator.cpp b/src/qml/compiler/qqmlpropertyvalidator.cpp index 1beaac8095..d20efe616b 100644 --- a/src/qml/compiler/qqmlpropertyvalidator.cpp +++ b/src/qml/compiler/qqmlpropertyvalidator.cpp @@ -692,7 +692,10 @@ QQmlCompileError QQmlPropertyValidator::validateObjectBinding(QQmlPropertyData * } else if (binding->flags & QV4::CompiledData::Binding::IsSignalHandlerObject && property->isFunction()) { return noError; } else if (QQmlValueTypeFactory::isValueType(property->propType())) { - return QQmlCompileError(binding->location, tr("Unexpected object assignment for property \"%1\"").arg(propertyName)); + auto typeName = QMetaType::typeName(property->propType()); + return QQmlCompileError(binding->location, tr("Can not assign value of type \"%1\" to property \"%2\", expecting an object") + .arg(typeName ? QString::fromLatin1(typeName) : QString::fromLatin1("<unknown type>")) + .arg(propertyName)); } else if (property->propType() == qMetaTypeId<QQmlScriptString>()) { return QQmlCompileError(binding->valueLocation, tr("Invalid property assignment: script expected")); } else { |