mirror of
https://github.com/fralx/LimeReport.git
synced 2025-01-27 16:33:25 +03:00
QQmlEngine -> QJSEngine
This commit is contained in:
parent
eacc5c645e
commit
2151a549e8
@ -138,13 +138,12 @@ namespace Const{
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_QJSENGINE
|
#ifdef USE_QJSENGINE
|
||||||
typedef QQmlEngine ScriptEngineType;
|
typedef QJSEngine ScriptEngineType;
|
||||||
typedef QJSValue ScriptValueType;
|
typedef QJSValue ScriptValueType;
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline QJSValue getCppOwnedJSValue(QJSEngine &e, T *p)
|
static inline QJSValue getJSValue(QJSEngine &e, T *p)
|
||||||
{
|
{
|
||||||
QJSValue res = e.newQObject(p);
|
QJSValue res = e.newQObject(p);
|
||||||
QQmlEngine::setObjectOwnership(p, QQmlEngine::CppOwnership);
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -299,7 +299,7 @@ void ReportRender::initRenderPage()
|
|||||||
ScriptEngineType* se = ScriptEngineManager::instance().scriptEngine();
|
ScriptEngineType* se = ScriptEngineManager::instance().scriptEngine();
|
||||||
|
|
||||||
#ifdef USE_QJSENGINE
|
#ifdef USE_QJSENGINE
|
||||||
svCurrentPage = getCppOwnedJSValue(*se, m_renderPageItem);
|
svCurrentPage = getJSValue(*se, m_renderPageItem);
|
||||||
se->globalObject().setProperty("currentPage", svCurrentPage);
|
se->globalObject().setProperty("currentPage", svCurrentPage);
|
||||||
#else
|
#else
|
||||||
svCurrentPage = se->globalObject().property("currentPage");
|
svCurrentPage = se->globalObject().property("currentPage");
|
||||||
|
@ -474,7 +474,7 @@ QString ScriptEngineManager::expandScripts(QString context, QVariant& varValue,
|
|||||||
ScriptValueType svThis;
|
ScriptValueType svThis;
|
||||||
|
|
||||||
#ifdef USE_QJSENGINE
|
#ifdef USE_QJSENGINE
|
||||||
svThis = getCppOwnedJSValue(*se, reportItem);
|
svThis = getJSValue(*se, reportItem);
|
||||||
se->globalObject().setProperty("THIS",svThis);
|
se->globalObject().setProperty("THIS",svThis);
|
||||||
#else
|
#else
|
||||||
svThis = se->globalObject().property("THIS");
|
svThis = se->globalObject().property("THIS");
|
||||||
@ -1280,7 +1280,7 @@ void ScriptEngineContext::baseDesignIntfToScript(const QString& pageName, BaseDe
|
|||||||
ScriptEngineType* engine = ScriptEngineManager::instance().scriptEngine();
|
ScriptEngineType* engine = ScriptEngineManager::instance().scriptEngine();
|
||||||
|
|
||||||
#ifdef USE_QJSENGINE
|
#ifdef USE_QJSENGINE
|
||||||
ScriptValueType sItem = getCppOwnedJSValue(*engine, item);
|
ScriptValueType sItem = getJSValue(*engine, item);
|
||||||
QString on = item->patternName().compare(pageName) == 0 ? pageName : pageName+"_"+item->patternName();
|
QString on = item->patternName().compare(pageName) == 0 ? pageName : pageName+"_"+item->patternName();
|
||||||
engine->globalObject().setProperty(on, sItem);
|
engine->globalObject().setProperty(on, sItem);
|
||||||
#else
|
#else
|
||||||
@ -1303,7 +1303,7 @@ void ScriptEngineContext::qobjectToScript(const QString& name, QObject *item)
|
|||||||
{
|
{
|
||||||
ScriptEngineType* engine = ScriptEngineManager::instance().scriptEngine();
|
ScriptEngineType* engine = ScriptEngineManager::instance().scriptEngine();
|
||||||
#ifdef USE_QJSENGINE
|
#ifdef USE_QJSENGINE
|
||||||
ScriptValueType sItem = getCppOwnedJSValue(*engine, item);
|
ScriptValueType sItem = getJSValue(*engine, item);
|
||||||
engine->globalObject().setProperty(name, sItem);
|
engine->globalObject().setProperty(name, sItem);
|
||||||
#else
|
#else
|
||||||
ScriptValueType sItem = engine->globalObject().property(name);
|
ScriptValueType sItem = engine->globalObject().property(name);
|
||||||
|
Loading…
Reference in New Issue
Block a user