本文整理汇总了C++中QScriptEnginePrivate::toPublic方法的典型用法代码示例。如果您正苦于以下问题:C++ QScriptEnginePrivate::toPublic方法的具体用法?C++ QScriptEnginePrivate::toPublic怎么用?C++ QScriptEnginePrivate::toPublic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QScriptEnginePrivate
的用法示例。
在下文中一共展示了QScriptEnginePrivate::toPublic方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: scope
/*!
\since 4.6
Returns the scope object of this QScriptValue. This function is only
relevant for function objects. The scope determines how variables are
resolved when the function is invoked.
*/
QScriptValue QScriptValue::scope() const
{
Q_D(const QScriptValue);
if (!d || !d->value.isObject())
return QScriptValue();
QScriptEnginePrivate *eng = QScriptEnginePrivate::get(engine());
return eng->toPublic(d->value.scope());
}
示例2: construct
/*!
Creates a new \c{Object} and calls this QScriptValue as a
constructor, using the created object as the `this' object and
passing \a arguments 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.
\a arguments can be an arguments object, an array, null or
undefined. Any other type will cause a TypeError to be thrown.
\sa call(), QScriptEngine::newObject(), QScriptContext::argumentsObject()
*/
QScriptValue QScriptValue::construct(const QScriptValue &arguments)
{
Q_D(QScriptValue);
if (!d || !d->value.isObject())
return QScriptValue();
QScriptEnginePrivate *eng = QScriptEnginePrivate::get(engine());
return eng->toPublic(d->value.construct(eng->toImpl(arguments)));
}
示例3: property
/*!
\overload
Returns the property at the given \a arrayIndex, using the given \a
mode to resolve the property.
This function is provided for convenience and performance when
working with array objects.
If this QScriptValue is not an Array object, this function behaves
as if property() was called with the string representation of \a
arrayIndex.
*/
QScriptValue QScriptValue::property(quint32 arrayIndex,
const ResolveFlags &mode) const
{
Q_D(const QScriptValue);
if (!d || !d->value.isObject())
return QScriptValue();
QScriptEnginePrivate *eng = QScriptEnginePrivate::get(engine());
return eng->toPublic(d->value.property(arrayIndex, mode));
}
示例4: toObject
/*!
\obsolete
This function is obsolete; use QScriptEngine::toObject() instead.
*/
QScriptValue QScriptValue::toObject() const
{
Q_D(const QScriptValue);
if (!d)
return QScriptValue();
QScriptEnginePrivate *eng = QScriptEnginePrivate::get(engine());
if (!eng)
return QScriptValue();
return eng->toPublic(eng->toObject(d->value));
}
示例5: call
/*!
Calls this QScriptValue as a function, using \a thisObject as
the `this' object in the function call, and passing \a arguments
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.
\a arguments can be an arguments object, an array, null or
undefined; any other type will cause a TypeError to be thrown.
Note that if \a thisObject is not an object, the global object
(see \l{QScriptEngine::globalObject()}) will be used as the
`this' object.
One common usage of this function is to forward native function
calls to another function:
\snippet doc/src/snippets/code/src_script_qscriptvalue.cpp 3
\sa construct(), QScriptContext::argumentsObject()
*/
QScriptValue QScriptValue::call(const QScriptValue &thisObject,
const QScriptValue &arguments)
{
Q_D(QScriptValue);
if (!d || !d->value.isObject())
return QScriptValue();
if (isFunction() && thisObject.isValid() && thisObject.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->toImpl(arguments)));
}