本文整理汇总了C++中QScriptEnginePrivate::toImplList方法的典型用法代码示例。如果您正苦于以下问题:C++ QScriptEnginePrivate::toImplList方法的具体用法?C++ QScriptEnginePrivate::toImplList怎么用?C++ QScriptEnginePrivate::toImplList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QScriptEnginePrivate
的用法示例。
在下文中一共展示了QScriptEnginePrivate::toImplList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: construct
/*!
Creates a new \c{Object} and calls this QScriptValue as a
constructor, using the created object as the `this' object and
passing \a args as arguments. If the return value from the
constructor call is an object, then that object is returned;
otherwise the default constructed object is returned.
If this QScriptValue is not a function, construct() does nothing
and returns an invalid QScriptValue.
Calling construct() can cause an exception to occur in the script
engine; in that case, construct() returns the value that was thrown
(typically an \c{Error} object). You can call
QScriptEngine::hasUncaughtException() to determine if an exception
occurred.
\sa call(), QScriptEngine::newObject()
*/
QScriptValue QScriptValue::construct(const QScriptValueList &args)
{
Q_D(QScriptValue);
if (!d || !d->value.isObject())
return QScriptValue();
QScriptEnginePrivate *eng = QScriptEnginePrivate::get(engine());
return eng->toPublic(d->value.construct(eng->toImplList(args)));
}
示例2: call
/*!
Calls this QScriptValue as a function, using \a thisObject as
the `this' object in the function call, and passing \a args
as arguments to the function. Returns the value returned from
the function.
If this QScriptValue is not a function, call() does nothing
and returns an invalid QScriptValue.
Note that if \a thisObject is not an object, the global object
(see \l{QScriptEngine::globalObject()}) will be used as the
`this' object.
Calling call() can cause an exception to occur in the script engine;
in that case, call() returns the value that was thrown (typically an
\c{Error} object). You can call
QScriptEngine::hasUncaughtException() to determine if an exception
occurred.
\snippet doc/src/snippets/code/src_script_qscriptvalue.cpp 2
\sa construct()
*/
QScriptValue QScriptValue::call(const QScriptValue &thisObject,
const QScriptValueList &args)
{
Q_D(QScriptValue);
if (!d || !d->value.isObject())
return QScriptValue();
if (isFunction() && thisObject.isValid() && thisObject.engine() &&
engine() && (thisObject.engine() != engine())) {
qWarning("QScriptValue::call() failed: "
"cannot call function with thisObject created in "
"a different engine");
return QScriptValue();
}
QScriptEnginePrivate *eng = QScriptEnginePrivate::get(engine());
return eng->toPublic(d->value.call(eng->toImpl(thisObject),
eng->toImplList(args)));
}