diff --git a/limereport/lrglobal.h b/limereport/lrglobal.h index fdc35d4..b32d263 100644 --- a/limereport/lrglobal.h +++ b/limereport/lrglobal.h @@ -138,13 +138,12 @@ namespace Const{ #endif #ifdef USE_QJSENGINE - typedef QQmlEngine ScriptEngineType; + typedef QJSEngine ScriptEngineType; typedef QJSValue ScriptValueType; template - static inline QJSValue getCppOwnedJSValue(QJSEngine &e, T *p) + static inline QJSValue getJSValue(QJSEngine &e, T *p) { QJSValue res = e.newQObject(p); - QQmlEngine::setObjectOwnership(p, QQmlEngine::CppOwnership); return res; } #else diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 9ad41f2..a6679bf 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -299,7 +299,7 @@ void ReportRender::initRenderPage() ScriptEngineType* se = ScriptEngineManager::instance().scriptEngine(); #ifdef USE_QJSENGINE - svCurrentPage = getCppOwnedJSValue(*se, m_renderPageItem); + svCurrentPage = getJSValue(*se, m_renderPageItem); se->globalObject().setProperty("currentPage", svCurrentPage); #else svCurrentPage = se->globalObject().property("currentPage"); diff --git a/limereport/lrscriptenginemanager.cpp b/limereport/lrscriptenginemanager.cpp index 3b2385e..6dd5ea8 100644 --- a/limereport/lrscriptenginemanager.cpp +++ b/limereport/lrscriptenginemanager.cpp @@ -474,7 +474,7 @@ QString ScriptEngineManager::expandScripts(QString context, QVariant& varValue, ScriptValueType svThis; #ifdef USE_QJSENGINE - svThis = getCppOwnedJSValue(*se, reportItem); + svThis = getJSValue(*se, reportItem); se->globalObject().setProperty("THIS",svThis); #else svThis = se->globalObject().property("THIS"); @@ -1280,7 +1280,7 @@ void ScriptEngineContext::baseDesignIntfToScript(const QString& pageName, BaseDe ScriptEngineType* engine = ScriptEngineManager::instance().scriptEngine(); #ifdef USE_QJSENGINE - ScriptValueType sItem = getCppOwnedJSValue(*engine, item); + ScriptValueType sItem = getJSValue(*engine, item); QString on = item->patternName().compare(pageName) == 0 ? pageName : pageName+"_"+item->patternName(); engine->globalObject().setProperty(on, sItem); #else @@ -1303,7 +1303,7 @@ void ScriptEngineContext::qobjectToScript(const QString& name, QObject *item) { ScriptEngineType* engine = ScriptEngineManager::instance().scriptEngine(); #ifdef USE_QJSENGINE - ScriptValueType sItem = getCppOwnedJSValue(*engine, item); + ScriptValueType sItem = getJSValue(*engine, item); engine->globalObject().setProperty(name, sItem); #else ScriptValueType sItem = engine->globalObject().property(name);