diff options
Diffstat (limited to 'src/declarative/qml/v8')
-rw-r--r-- | src/declarative/qml/v8/qjsvalue.cpp | 18 | ||||
-rw-r--r-- | src/declarative/qml/v8/qjsvalue.h | 1 |
2 files changed, 16 insertions, 3 deletions
diff --git a/src/declarative/qml/v8/qjsvalue.cpp b/src/declarative/qml/v8/qjsvalue.cpp index 482216ac49..a43dd33f14 100644 --- a/src/declarative/qml/v8/qjsvalue.cpp +++ b/src/declarative/qml/v8/qjsvalue.cpp @@ -71,7 +71,7 @@ Object values have an internal \c{prototype} property, which can be accessed with prototype() and setPrototype(). - Function objects (objects for which isFunction() returns true) can + Function objects (objects for which isCallable()) returns true) can be invoked by calling call(). Constructor functions can be used to construct new objects by calling construct(). @@ -461,11 +461,23 @@ bool QJSValue::isObject() const } /*! - Returns true if this QJSValue is a function; otherwise returns - false. + Returns true if this QJSValue can be called a function, otherwise + returns false. \sa call() */ +bool QJSValue::isCallable() const +{ + Q_D(const QJSValue); + QScriptIsolate api(d->engine()); + return d->isCallable(); +} + +/*! + \obsolete + + Use isCallable() instead. +*/ bool QJSValue::isFunction() const { Q_D(const QJSValue); diff --git a/src/declarative/qml/v8/qjsvalue.h b/src/declarative/qml/v8/qjsvalue.h index 4467cef354..8a15c4e0f2 100644 --- a/src/declarative/qml/v8/qjsvalue.h +++ b/src/declarative/qml/v8/qjsvalue.h @@ -140,6 +140,7 @@ public: QJSValue::PropertyFlags propertyFlags(const QString &name) const; + bool isCallable() const; QJSValue call(const QJSValue &thisObject = QJSValue(), const QJSValueList &args = QJSValueList()); QJSValue construct(const QJSValueList &args = QJSValueList()); |