本文整理汇总了C++中SkinContext::variables方法的典型用法代码示例。如果您正苦于以下问题:C++ SkinContext::variables方法的具体用法?C++ SkinContext::variables怎么用?C++ SkinContext::variables使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkinContext
的用法示例。
在下文中一共展示了SkinContext::variables方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: it
SkinContext::SkinContext(const SkinContext& parent)
: m_xmlPath(parent.m_xmlPath),
m_skinBasePath(parent.m_skinBasePath),
m_pConfig(parent.m_pConfig),
m_variables(parent.variables()),
m_pScriptEngine(parent.m_pScriptEngine),
m_pScriptDebugger(parent.m_pScriptDebugger),
m_parentGlobal(m_pScriptEngine->globalObject()),
m_pSingletons(parent.m_pSingletons) {
// we generate a new global object to preserve the scope between
// a context and its children
QScriptValue context = m_pScriptEngine->pushContext()->activationObject();
QScriptValue newGlobal = m_pScriptEngine->newObject();
QScriptValueIterator it(m_parentGlobal);
while (it.hasNext()) {
it.next();
newGlobal.setProperty(it.name(), it.value());
}
m_pScriptEngine->setGlobalObject(newGlobal);
for (QHash<QString, QString>::const_iterator it = m_variables.begin();
it != m_variables.end(); ++it) {
m_pScriptEngine->globalObject().setProperty(it.key(), it.value());
}
}
示例2: it
SkinContext::SkinContext(const SkinContext& parent)
: m_skinBasePath(parent.m_skinBasePath),
m_pConfig(parent.m_pConfig),
m_variables(parent.variables()),
m_pScriptEngine(parent.m_pScriptEngine),
m_pScriptDebugger(parent.m_pScriptDebugger),
m_parentGlobal(m_pScriptEngine->globalObject()),
m_hookRx(parent.m_hookRx),
m_pSvgCache(parent.m_pSvgCache),
m_pSingletons(parent.m_pSingletons),
m_scaleFactor(parent.m_scaleFactor) {
// we generate a new global object to preserve the scope between
// a context and its children
setXmlPath(parent.m_xmlPath);
QScriptValue context = m_pScriptEngine->pushContext()->activationObject();
QScriptValue newGlobal = m_pScriptEngine->newObject();
QScriptValueIterator it(m_parentGlobal);
while (it.hasNext()) {
it.next();
newGlobal.setProperty(it.name(), it.value());
}
for (auto it = m_variables.constBegin();
it != m_variables.constEnd(); ++it) {
newGlobal.setProperty(it.key(), it.value());
}
m_pScriptEngine->setGlobalObject(newGlobal);
}