本文整理汇总了C++中QScriptEngine::setAgent方法的典型用法代码示例。如果您正苦于以下问题:C++ QScriptEngine::setAgent方法的具体用法?C++ QScriptEngine::setAgent怎么用?C++ QScriptEngine::setAgent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QScriptEngine
的用法示例。
在下文中一共展示了QScriptEngine::setAgent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: detach
/*!
Detaches this backend from the current script engine.
The backend's state (including breakpoints and information on loaded
scripts) will be invalidated.
\sa attach()
*/
void QScriptDebuggerBackend::detach()
{
Q_D(QScriptDebuggerBackend);
if (!d->agent)
return;
QScriptEngine *eng = d->agent->engine();
if (eng && eng->agent() == d->agent) {
eng->setAgent(0);
QScriptValue global = eng->globalObject();
if (global.property(QString::fromLatin1("print")).strictlyEquals(traceFunction()))
global.setProperty(QString::fromLatin1("print"), QScriptValue());
// global.setProperty(QString::fromLatin1("qAssert"), QScriptValue());
if (global.property(QString::fromLatin1("__FILE__")).strictlyEquals(fileNameFunction()))
global.setProperty(QString::fromLatin1("__FILE__"), QScriptValue());
if (global.property(QString::fromLatin1("__LINE__")).strictlyEquals(lineNumberFunction()))
global.setProperty(QString::fromLatin1("__LINE__"), QScriptValue());
d->agent->nullifyBackendPointer();
d->agent = 0; // agent is owned by engine
}
d->pendingEvaluateLineNumber = -1;
d->ignoreExceptions = false;
d->nextScriptValueIteratorId = 0;
qDeleteAll(d->scriptValueIterators);
d->scriptValueIterators.clear();
qDeleteAll(d->scriptObjectSnapshots);
d->scriptObjectSnapshots.clear();
}