aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsapi
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2023-08-15 09:21:24 +0200
committerFabian Kosmale <fabian.kosmale@qt.io>2023-08-15 14:13:32 +0200
commitfead337daa3e339676b05f0f152864455752dfb3 (patch)
treefa7bd75ef6dfc5c05b1e2911e3206f0316945792 /src/qml/jsapi
parentc49c98fa3ea2306830d7a80fa1582faf6e432b57 (diff)
QJSEngine::evaluate: Cross-reference QQmlExpression
QJSEngine::evaluate is meant for plain JavaScript; guide readers wanting to use it with QML to the correct place. Pick-to: 6.2 6.5 6.6 Change-Id: If8016a4cca2999d95bac47e83159b1e10eb5a0d5 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/jsapi')
-rw-r--r--src/qml/jsapi/qjsengine.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/qml/jsapi/qjsengine.cpp b/src/qml/jsapi/qjsengine.cpp
index 3d75bf4032..374d170019 100644
--- a/src/qml/jsapi/qjsengine.cpp
+++ b/src/qml/jsapi/qjsengine.cpp
@@ -474,6 +474,9 @@ static QUrl urlForFileName(const QString &fileName)
The script code will be evaluated in the context of the global object.
+ \note If you need to evaluate inside a QML context, use \l QQmlExpression
+ instead.
+
The evaluation of \a program can cause an \l{Script Exceptions}{exception} in the
engine; in this case the return value will be the exception
that was thrown (typically an \c{Error} object; see
@@ -504,6 +507,8 @@ static QUrl urlForFileName(const QString &fileName)
exception value will still be returned. Use \c exceptionStackTrace->isEmpty()
to distinguish whether the value was a normal or an exceptional return
value.
+
+ \sa QQmlExpression::evaluate
*/
QJSValue QJSEngine::evaluate(const QString& program, const QString& fileName, int lineNumber, QStringList *exceptionStackTrace)
{