diff --git a/CMakeLists.txt b/CMakeLists.txt index e17cef9..f22450b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16.0) project(JlQML) -set(JlQML_VERSION 0.10.2) +set(JlQML_VERSION 0.10.3) message(STATUS "Project version: v${JlQML_VERSION}") set(CMAKE_MACOSX_RPATH 1) diff --git a/wrap_qml.hpp b/wrap_qml.hpp index 1459ae0..c71d1eb 100644 --- a/wrap_qml.hpp +++ b/wrap_qml.hpp @@ -41,7 +41,8 @@ template<> struct SuperType { using type = QObject; }; template<> struct SuperType { using type = QCoreApplication; }; template<> struct SuperType { using type = QObject; }; template<> struct SuperType { using type = QObject; }; -template<> struct SuperType { using type = QObject; }; +template<> struct SuperType { using type = QObject; }; +template<> struct SuperType { using type = QJSEngine; }; template<> struct SuperType { using type = QObject; }; template<> struct SuperType { using type = QQmlPropertyMap; }; template<> struct SuperType { using type = QQuickWindow; }; diff --git a/wrap_qml_part_a.cpp b/wrap_qml_part_a.cpp index be9e2cd..612defc 100644 --- a/wrap_qml_part_a.cpp +++ b/wrap_qml_part_a.cpp @@ -5,6 +5,7 @@ void wrap_part_a(jlcxx::Module& qml_module) using namespace jlcxx; qml_module.add_type("QObject") + .method("parent", &QObject::parent) .method("deleteLater", &QObject::deleteLater); qml_module.method("connect_destroyed_signal", [] (QObject& obj, jl_value_t* jl_f) { diff --git a/wrap_qml_part_b.cpp b/wrap_qml_part_b.cpp index 5dd81bb..7c0bcca 100644 --- a/wrap_qml_part_b.cpp +++ b/wrap_qml_part_b.cpp @@ -17,7 +17,20 @@ void wrap_part_b(jlcxx::Module& qml_module) qml_module.add_type("QQmlImageProviderBase", julia_base_type()); - qml_module.add_type("QQmlEngine", julia_base_type()) + qml_module.add_enum("ObjectOwnership", + std::vector({ + "CppOwnership", + "JavaScriptOwnership" + }), + std::vector({ + QJSEngine::CppOwnership, + QJSEngine::JavaScriptOwnership + }) + ); + + qml_module.add_type("QJSEngine", julia_base_type()); + qml_module.method("setObjectOwnership", QJSEngine::setObjectOwnership); + qml_module.add_type("QQmlEngine", julia_base_type()) .method("addImageProvider", &QQmlEngine::addImageProvider) .method("clearComponentCache", &QQmlEngine::clearComponentCache) .method("clearSingletons", &QQmlEngine::clearSingletons)