File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,14 +33,14 @@ class MakieRenderFunction : public RenderFunction
3333
3434jl_module_t * get_makie_support_module ()
3535{
36- // MakieViewport::m_qml_mod is set when initializing the Julia module `QtMakie `,
37- // corresponding to `JLCXX_MODULE define_julia_module_makie` in `wrap_qml.cpp`.
38- jl_module_t * mod = MakieViewport::m_qml_mod ;
36+ // MakieViewport::m_qmlmakie_mod is set when initializing the Julia module `QMLMakie `,
37+ // by calling ` define_julia_module_makie` in `wrap_qml.cpp`.
38+ jl_module_t * mod = MakieViewport::m_qmlmakie_mod ;
3939
4040 // If `mod` is not initialized, you have not loaded the Julia module.
4141 if (mod == nullptr )
4242 {
43- throw std::runtime_error (" Makie Support not initialized. Have you loaded QtMakie ?" );
43+ throw std::runtime_error (" Makie Support not initialized. Have you loaded QMLMakie ?" );
4444 }
4545
4646 return mod;
@@ -75,6 +75,7 @@ struct MakieSupport
7575
7676MakieViewport::MakieViewport (QQuickItem *parent) : OpenGLViewport(parent, new MakieRenderFunction(m_screen))
7777{
78+ get_makie_support_module (); // Throw the possible error early
7879 QObject::connect (this , &QQuickItem::windowChanged, [this ] (QQuickWindow* w)
7980 {
8081 if (w == nullptr )
@@ -111,6 +112,6 @@ void MakieViewport::setup_buffer(QOpenGLFramebufferObject* fbo)
111112 }
112113}
113114
114- jl_module_t * MakieViewport::m_qml_mod = nullptr ;
115+ jl_module_t * MakieViewport::m_qmlmakie_mod = nullptr ;
115116
116117} // namespace qmlwrap
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ class MakieViewport : public OpenGLViewport
1414public:
1515 MakieViewport (QQuickItem* parent = 0 );
1616 virtual ~MakieViewport ();
17- static jl_module_t * m_qml_mod ;
17+ static jl_module_t * m_qmlmakie_mod ;
1818
1919private:
2020 // Screen created and used on the Julia side
Original file line number Diff line number Diff line change @@ -282,12 +282,6 @@ struct WrapQtAssociativeContainer
282282
283283}
284284
285- JLCXX_MODULE define_julia_module_makie (jlcxx::Module& qml_module)
286- {
287- using namespace jlcxx ;
288- qmlwrap::MakieViewport::m_qml_mod = qml_module.julia_module ();
289- }
290-
291285JLCXX_MODULE define_julia_module (jlcxx::Module& qml_module)
292286{
293287 using namespace jlcxx ;
@@ -297,6 +291,11 @@ JLCXX_MODULE define_julia_module(jlcxx::Module& qml_module)
297291 qmlwrap::ApplicationManager::m_qml_mod = qml_module.julia_module ();
298292 qmlwrap::JuliaItemModel::m_qml_mod = qml_module.julia_module ();
299293
294+ qml_module.method (" define_julia_module_makie" , [](jl_value_t * mod)
295+ {
296+ qmlwrap::MakieViewport::m_qmlmakie_mod = reinterpret_cast <jl_module_t *>(mod);
297+ });
298+
300299 // Enums
301300 qml_module.add_bits <Qt::Orientation>(" Orientation" , jlcxx::julia_type (" CppEnum" ));
302301 qml_module.set_const (" Horizontal" , Qt::Horizontal);
You can’t perform that action at this time.
0 commit comments