diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-11-11 23:54:59 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-11-11 23:54:59 (GMT) |
commit | 49cc2d35d7da4a78d696503930720e88a6403722 (patch) | |
tree | 866c8158e2784860f49dc7af78f3559971daeb4c /src/declarative | |
parent | 1795d7b20eccf20de84c9a688841d818b6a82c08 (diff) | |
download | Qt-49cc2d35d7da4a78d696503930720e88a6403722.zip Qt-49cc2d35d7da4a78d696503930720e88a6403722.tar.gz Qt-49cc2d35d7da4a78d696503930720e88a6403722.tar.bz2 |
Output error when a binding returns undefined
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/qml/qmlbinding.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/declarative/qml/qmlbinding.cpp b/src/declarative/qml/qmlbinding.cpp index b0a4d6e..ef92308 100644 --- a/src/declarative/qml/qmlbinding.cpp +++ b/src/declarative/qml/qmlbinding.cpp @@ -175,7 +175,18 @@ void QmlBinding::update(QmlMetaProperty::WriteFlags flags) bool isUndefined = false; QVariant value = this->value(&isUndefined); - if (!isUndefined && data->property.object() && + if (isUndefined && !data->error.isValid()) { + + QUrl url = 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 [undefined] to ") + QLatin1String(QMetaType::typeName(data->property.propertyType()))); + + } else if (!isUndefined && data->property.object() && !data->property.write(value, flags)) { QUrl url = data->url; |