summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlexpression.cpp
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-10-16 06:20:19 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-10-16 06:20:19 (GMT)
commitb49b85d4c0decce35e1ad4a0b08dc9c0c82b384e (patch)
tree3e947e7ba5d06a827707777c80491ac8d1f013d9 /src/declarative/qml/qmlexpression.cpp
parentdc66752f24442a0bb219a9a4810b47ba4ece3d5c (diff)
parentc017a4dc6b5a81136b3654ca0ac75630cdf11675 (diff)
downloadQt-b49b85d4c0decce35e1ad4a0b08dc9c0c82b384e.zip
Qt-b49b85d4c0decce35e1ad4a0b08dc9c0c82b384e.tar.gz
Qt-b49b85d4c0decce35e1ad4a0b08dc9c0c82b384e.tar.bz2
Merge branch 'kinetic-declarativeui' of scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative/qml/qmlexpression.cpp')
-rw-r--r--src/declarative/qml/qmlexpression.cpp41
1 files changed, 29 insertions, 12 deletions
diff --git a/src/declarative/qml/qmlexpression.cpp b/src/declarative/qml/qmlexpression.cpp
index d73d51a..356c3c6 100644
--- a/src/declarative/qml/qmlexpression.cpp
+++ b/src/declarative/qml/qmlexpression.cpp
@@ -338,20 +338,17 @@ QVariant QmlExpressionPrivate::evalQtScript(QObject *secondaryScope)
rv = QVariant::fromValue(list);
}
} else if (svalue.isObject() &&
- !svalue.isNumber() &&
- !svalue.isString() &&
- !svalue.isDate() &&
- !svalue.isError() &&
- !svalue.isFunction() &&
- !svalue.isNull() &&
- !svalue.isQMetaObject() &&
- !svalue.isQObject() &&
- !svalue.isRegExp()) {
-
+ ep->objectClass->scriptClass(svalue) == ep->objectClass) {
QObject *o = svalue.toQObject();
- if (o)
- return qVariantFromValue(o);
+ int type = QMetaType::QObjectStar;
+ // If the object is null, we extract the predicted type. While this isn't
+ // 100% reliable, in many cases it gives us better error messages if we
+ // assign this null-object to an incompatible property
+ if (!o) type = ep->objectClass->objectType(svalue);
+
+ return QVariant(type, &o);
}
+
if (rv.isNull())
rv = svalue.toVariant();
@@ -458,6 +455,26 @@ void QmlExpression::setTrackChange(bool trackChange)
}
/*!
+ Returns the source file URL for this expression. The source location must
+ have been previously set by calling setSourceLocation().
+*/
+QUrl QmlExpression::sourceFile() const
+{
+ Q_D(const QmlExpression);
+ return QUrl(d->data->fileName);
+}
+
+/*!
+ Returns the source file line number for this expression. The source location
+ must have been previously set by calling setSourceLocation().
+*/
+int QmlExpression::lineNumber() const
+{
+ Q_D(const QmlExpression);
+ return d->data->line;
+}
+
+/*!
Set the location of this expression to \a line of \a fileName. This information
is used by the script engine.
*/