aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlproperty.cpp
diff options
context:
space:
mode:
authorMark Visser <mjmvisser@gmail.com>2013-04-30 14:12:37 -0400
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-05-08 10:46:13 +0200
commit13afb2b49daec9f5f65dc9a99151c91d685dce13 (patch)
tree79c00dec10a6d90152213c0a85fafe6a9a480a95 /src/qml/qml/qqmlproperty.cpp
parent22fc92cf9187460785a05e31620823fe8afe5eab (diff)
QQmlError.object now holds the scope object that caused exceptions.
Exception errors sent via QQmlEngine::warnings lacked a pointer to the containing scope. I added an object property to QQmlError, and the necessary code to fill it with the QObject* scope from binding exception callbacks. Task-number: QTBUG-30930 Change-Id: I2a987e8cefc3a2a474d338893e9ebcb77c167adf Reviewed-by: Kai Koehne <kai.koehne@digia.com> Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Diffstat (limited to 'src/qml/qml/qqmlproperty.cpp')
-rw-r--r--src/qml/qml/qqmlproperty.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp
index 0baf450cbf..0936df59c4 100644
--- a/src/qml/qml/qqmlproperty.cpp
+++ b/src/qml/qml/qqmlproperty.cpp
@@ -1555,6 +1555,7 @@ bool QQmlPropertyPrivate::writeBinding(QObject *object,
// we explicitly disallow this case to avoid confusion. Users can still store one
// in an array in a var property if they need to, but the common case is user error.
expression->delayedError()->setErrorDescription(QLatin1String("Invalid use of Qt.binding() in a binding declaration."));
+ expression->delayedError()->setErrorObject(object);
return false;
}
@@ -1570,6 +1571,7 @@ bool QQmlPropertyPrivate::writeBinding(QObject *object,
if (!result.IsEmpty() && result->IsFunction()
&& !result->ToObject()->GetHiddenValue(v8engine->bindingFlagKey()).IsEmpty()) {
expression->delayedError()->setErrorDescription(QLatin1String("Invalid use of Qt.binding() in a binding declaration."));
+ expression->delayedError()->setErrorObject(object);
return false;
}
writeValueProperty(object, core, QVariant::fromValue(v8engine->scriptValueFromInternal(result)), context, flags);
@@ -1580,12 +1582,14 @@ bool QQmlPropertyPrivate::writeBinding(QObject *object,
else
errorStr += QLatin1String(QMetaType::typeName(type));
expression->delayedError()->setErrorDescription(errorStr);
+ expression->delayedError()->setErrorObject(object);
return false;
} else if (result->IsFunction()) {
if (!result->ToObject()->GetHiddenValue(v8engine->bindingFlagKey()).IsEmpty())
expression->delayedError()->setErrorDescription(QLatin1String("Invalid use of Qt.binding() in a binding declaration."));
else
expression->delayedError()->setErrorDescription(QLatin1String("Unable to assign a function to a property of any type other than var."));
+ expression->delayedError()->setErrorObject(object);
return false;
} else if (!writeValueProperty(object, core, value, context, flags)) {
@@ -1618,6 +1622,7 @@ bool QQmlPropertyPrivate::writeBinding(QObject *object,
QLatin1String(valueType) +
QLatin1String(" to ") +
QLatin1String(propertyType));
+ expression->delayedError()->setErrorObject(object);
return false;
}