diff options
author | Martin Jones <martin.jones@nokia.com> | 2009-10-22 01:59:33 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2009-10-22 01:59:33 (GMT) |
commit | 6c9ac788a60fcd2f946787a5297d7c2f71ad1968 (patch) | |
tree | af53424d7d2adfcbb324624ab93d31845d3db80d /src/declarative/qml/qmlexpression.cpp | |
parent | 2391cf5d127882ce8811e058115d5c2605328079 (diff) | |
parent | fa85d539decf7bdcb16fa8f52858b13479cea659 (diff) | |
download | Qt-6c9ac788a60fcd2f946787a5297d7c2f71ad1968.zip Qt-6c9ac788a60fcd2f946787a5297d7c2f71ad1968.tar.gz Qt-6c9ac788a60fcd2f946787a5297d7c2f71ad1968.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.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/declarative/qml/qmlexpression.cpp b/src/declarative/qml/qmlexpression.cpp index cfa9469..d2bf4a8 100644 --- a/src/declarative/qml/qmlexpression.cpp +++ b/src/declarative/qml/qmlexpression.cpp @@ -281,7 +281,7 @@ void QmlExpressionPrivate::printException(QScriptEngine *scriptEngine) } } -QVariant QmlExpressionPrivate::evalQtScript(QObject *secondaryScope) +QVariant QmlExpressionPrivate::evalQtScript(QObject *secondaryScope, bool *isUndefined) { #ifdef Q_ENABLE_PERFORMANCE_LOG QFxPerfTimer<QFxPerf::BindValueQt> perfqt; @@ -318,6 +318,9 @@ QVariant QmlExpressionPrivate::evalQtScript(QObject *secondaryScope) QScriptValue svalue = data->expressionFunction.call(); + if (isUndefined) + *isUndefined = svalue.isUndefined(); + if (scriptEngine->hasUncaughtException()) printException(scriptEngine); @@ -355,7 +358,7 @@ QVariant QmlExpressionPrivate::evalQtScript(QObject *secondaryScope) return rv; } -QVariant QmlExpressionPrivate::value(QObject *secondaryScope) +QVariant QmlExpressionPrivate::value(QObject *secondaryScope, bool *isUndefined) { Q_Q(QmlExpression); @@ -382,7 +385,7 @@ QVariant QmlExpressionPrivate::value(QObject *secondaryScope) if (data->sse.isValid()) { rv = evalSSE(); } else { - rv = evalQtScript(secondaryScope); + rv = evalQtScript(secondaryScope, isUndefined); } ep->currentExpression = lastCurrentExpression; @@ -406,11 +409,14 @@ QVariant QmlExpressionPrivate::value(QObject *secondaryScope) /*! Returns the value of the expression, or an invalid QVariant if the expression is invalid or has an error. + + \a isUndefined is set to true if the expression resulted in an + undefined value. */ -QVariant QmlExpression::value() +QVariant QmlExpression::value(bool *isUndefined) { Q_D(QmlExpression); - return d->value(); + return d->value(0, isUndefined); } /*! |