From fbc48d2631af04c2942b407e4acea53c82a60e1b Mon Sep 17 00:00:00 2001 From: Rainer Keller Date: Mon, 4 Jun 2018 10:15:33 +0200 Subject: Improve error message Show information about used types to help the user determine what went wrong. Change-Id: Ia71f21ee2bd53ba751bf0a3f7718f949d0e8330d Reviewed-by: Mitch Curtis Reviewed-by: Simon Hausmann --- src/qml/compiler/qqmlpropertyvalidator.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/qml/compiler/qqmlpropertyvalidator.cpp') diff --git a/src/qml/compiler/qqmlpropertyvalidator.cpp b/src/qml/compiler/qqmlpropertyvalidator.cpp index 8ebd2da1c9..afa2e4ad81 100644 --- a/src/qml/compiler/qqmlpropertyvalidator.cpp +++ b/src/qml/compiler/qqmlpropertyvalidator.cpp @@ -693,7 +693,8 @@ QQmlCompileError QQmlPropertyValidator::validateObjectBinding(QQmlPropertyData * } if (!isAssignable) { - return QQmlCompileError(binding->valueLocation, tr("Cannot assign object to property")); + return QQmlCompileError(binding->valueLocation, tr("Cannot assign object of type \"%1\" to property of type \"%2\" as the former is neither the same as the latter nor a sub-class of it.") + .arg(stringAt(qmlUnit->objectAt(binding->value.objectIndex)->inheritedTypeNameIndex)).arg(QLatin1String(QMetaType::typeName(property->propType())))); } } return noError; -- cgit v1.2.3