diff --git a/include/lrglobal.h b/include/lrglobal.h index 80568c5..103edfc 100644 --- a/include/lrglobal.h +++ b/include/lrglobal.h @@ -156,7 +156,8 @@ namespace Const{ template static inline QJSValue getJSValue(QJSEngine &e, T *p) { - QJSValue res = e.toScriptValue(p); + QJSValue res = e.newQObject(p); + QQmlEngine::setObjectOwnership(p, QQmlEngine::CppOwnership); return res; } #else diff --git a/limereport/lrglobal.h b/limereport/lrglobal.h index 80568c5..103edfc 100644 --- a/limereport/lrglobal.h +++ b/limereport/lrglobal.h @@ -156,7 +156,8 @@ namespace Const{ template static inline QJSValue getJSValue(QJSEngine &e, T *p) { - QJSValue res = e.toScriptValue(p); + QJSValue res = e.newQObject(p); + QQmlEngine::setObjectOwnership(p, QQmlEngine::CppOwnership); return res; } #else