# QML.jl makie-plot example gives multiple errors

**URL:** <https://discourse.julialang.org/t/qml-jl-makie-plot-example-gives-multiple-errors/128444>\
**Category:** General Usage\
**Tags:** bug, makie, qml\
**Created:** [April 26, 2025, 6:35pm UTC](https://discourse.julialang.org/t/qml-jl-makie-plot-example-gives-multiple-errors/128444 "2025-04-26T18:35:31Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tetrakai](https://avatars.discourse-cdn.com/v4/letter/t/4da419/32.png) [@Tetrakai](https://discourse.julialang.org/u/Tetrakai)\
**Post date:** [April 26, 2025, 6:35pm UTC](https://discourse.julialang.org/t/qml-jl-makie-plot-example-gives-multiple-errors/128444/1 "2025-04-26T18:35:31Z")

</div>

I’m trying to run this (pasting in the REPL):

> <https://github.com/barche/QmlJuliaExamples/blob/master/opengl/makie-plot.jl>

First error occurs on `using GLMakie`:

> **Summary**
>
> ```julia
> julia> using GLMakie
> ┌ Warning: Error requiring `GLMakie` from `QML`
> │ exception =
> │ LoadError: UndefVarError: `GLScreen` not defined in `GLMakie`
> │ Suggestion: check for spelling errors or missing imports.
> │ Stacktrace:
> │ [1] getproperty(x::Module, f::Symbol)
> │ @ Base ./Base.jl:42
> │ [2] top-level scope
> │ @ ~/.julia/packages/QML/l73pC/src/makie_support.jl:51
> │ [3] include(mod::Module, _path::String)
> │ @ Base ./Base.jl:557
> │ [4] include(x::String)
> │ @ QML ~/.julia/packages/QML/l73pC/src/QML.jl:1
> │ [5] top-level scope
> │ @ none:1
> │ [6] eval
> │ @ ./boot.jl:430 [inlined]
> │ [7] eval
> │ @ ~/.julia/packages/QML/l73pC/src/QML.jl:1 [inlined]
> │ [8] (::QML.var"#7#13")()
> │ @ QML ~/.julia/packages/Requires/1eCOK/src/require.jl:101
> │ [9] macro expansion
> │ @ timing.jl:421 [inlined]
> │ [10] err(f::Any, listener::Module, modname::String, file::String, line::Any)
> │ @ Requires ~/.julia/packages/Requires/1eCOK/src/require.jl:47
> │ [11] (::QML.var"#6#12")()
> │ @ QML ~/.julia/packages/Requires/1eCOK/src/require.jl:100
> │ [12] withpath(f::Any, path::String)
> │ @ Requires ~/.julia/packages/Requires/1eCOK/src/require.jl:37
> │ [13] (::QML.var"#5#11")()
> │ @ QML ~/.julia/packages/Requires/1eCOK/src/require.jl:99
> │ [14] #invokelatest#2
> │ @ ./essentials.jl:1055 [inlined]
> │ [15] invokelatest
> │ @ ./essentials.jl:1052 [inlined]
> │ [16] foreach(f::typeof(invokelatest), itr::Vector{Function})
> │ @ Base ./abstractarray.jl:3187
> │ [17] loadpkg(pkg::Base.PkgId)
> │ @ Requires ~/.julia/packages/Requires/1eCOK/src/require.jl:27
> │ [18] #invokelatest#2
> │ @ ./essentials.jl:1055 [inlined]
> │ [19] invokelatest
> │ @ ./essentials.jl:1052 [inlined]
> │ [20] run_package_callbacks(modkey::Base.PkgId)
> │ @ Base ./loading.jl:1401
> │ [21] __require_prelocked(uuidkey::Base.PkgId, env::String)
> │ @ Base ./loading.jl:2399
> │ [22] #invoke_in_world#3
> │ @ ./essentials.jl:1089 [inlined]
> │ [23] invoke_in_world
> │ @ ./essentials.jl:1086 [inlined]
> │ [24] _require_prelocked(uuidkey::Base.PkgId, env::String)
> │ @ Base ./loading.jl:2375
> │ [25] macro expansion
> │ @ ./loading.jl:2314 [inlined]
> │ [26] macro expansion
> │ @ ./lock.jl:273 [inlined]
> │ [27] __require(into::Module, mod::Symbol)
> │ @ Base ./loading.jl:2271
> │ [28] #invoke_in_world#3
> │ @ ./essentials.jl:1089 [inlined]
> │ [29] invoke_in_world
> │ @ ./essentials.jl:1086 [inlined]
> │ [30] require(into::Module, mod::Symbol)
> │ @ Base ./loading.jl:2260
> │ [31] eval
> │ @ ./boot.jl:430 [inlined]
> │ [32] eval_user_input(ast::Any, backend::REPL.REPLBackend, mod::Module)
> │ @ REPL ~/.julia/juliaup/julia-1.11.5+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/REPL.jl:261
> │ [33] repl_backend_loop(backend::REPL.REPLBackend, get_module::Function)
> │ @ REPL ~/.julia/juliaup/julia-1.11.5+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/REPL.jl:368
> │ [34] start_repl_backend(backend::REPL.REPLBackend, consumer::Any; get_module::Function)
> │ @ REPL ~/.julia/juliaup/julia-1.11.5+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/REPL.jl:343
> │ [35] run_repl(repl::REPL.AbstractREPL, consumer::Any; backend_on_current_task::Bool, backend::Any)
> │ @ REPL ~/.julia/juliaup/julia-1.11.5+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/REPL.jl:500
> │ [36] run_repl(repl::REPL.AbstractREPL, consumer::Any)
> │ @ REPL ~/.julia/juliaup/julia-1.11.5+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/REPL.jl:486
> │ [37] (::Base.var"#1150#1152"{Bool, Symbol, Bool})(REPL::Module)
> │ @ Base ./client.jl:446
> │ [38] #invokelatest#2
> │ @ ./essentials.jl:1055 [inlined]
> │ [39] invokelatest
> │ @ ./essentials.jl:1052 [inlined]
> │ [40] run_main_repl(interactive::Bool, quiet::Bool, banner::Symbol, history_file::Bool, color_set::Bool)
> │ @ Base ./client.jl:430
> │ [41] repl_main
> │ @ ./client.jl:567 [inlined]
> │ [42] _start()
> │ @ Base ./client.jl:541
> │ in expression starting at /home/user/.julia/packages/QML/l73pC/src/makie_support.jl:1
> └ @ Requires ~/.julia/packages/Requires/1eCOK/src/require.jl:51
> 
> ```

- However, if I run `using GLMakie` again it _seems_ to work.

Second error occurs on `figscene = fig.scene`.

- Fixed: this is due to running it in the REPL, suppressed the plot with a semicolon.

Third error is due to `Point2f0` and `Vec4f0`.

- Fixed: changed these to `Point2f` and `Vec4f`

Fourth error is on `loadqml` and/or `exec`:

> **Summary**
>
> ```julia
> julia> loadqml(joinpath(pwd(), "code", "qml", "makie-plot.qml"),
> positionModel = positionmodel,
> updates = JuliaPropertyMap("needupdate" => needupdate),
> render_callback = @safe_cfunction(render_function, Cvoid, (Any,))
> )
> CxxPtr{QML.QQmlApplicationEngine}(Ptr{QML.QQmlApplicationEngine} @0x0000000040f9dc60)
> 
> julia> exec()
> Qt Warning: Qt has caught an exception thrown from an event handler. Throwing
> exceptions from an event handler is not supported in Qt.
> You must not let any exception whatsoever propagate through Qt code. ((null):0, (null))
> ERROR: Storing a null function pointer in a JuliaFunction is not allowed
> Stacktrace:
> [1] exec()
> @ QML ~/.julia/packages/CxxWrap/I0P2E/src/CxxWrap.jl:676
> [2] top-level scope
> @ REPL[29]:1
> 
> ```

- A black Qt window opens (early?) when running `loadqml`, then requires a force quit. If `exec` is run anyway I get the above error.

My attempted fixes are in this script:

> **Summary**
>
> ```julia
> # MUST disable threading in Qt
> ENV["QSG_RENDER_LOOP"] = "basic"
> 
> using CxxWrap
> using Observables
> using QML
> using GLMakie
> using GLMakie
> using Makie
> using GeometryBasics
> 
> const xpos = Observable(collect(0.1:0.05:0.3))
> const ypos = Observable(rand(length(xpos[])))
> 
> fig, ax, pl = lines(xpos, ypos, color = :blue);
> autolimits!(ax);
> 
> figscene = fig.scene;
> axscene = ax.scene;
> 
> const needupdate = Observable(true)
> 
> on(ax.finallimits) do l
> needupdate[] = true
> end
> 
> positionmodel = JuliaItemModel(tuple.(xpos[], ypos[]), false)
> 
> # Convert model coordinates to screen (inverse of to_world)
> function to_screen(scene, point)
> cam = scene.camera
> plotrect = pixelarea(scene)[]
> cam_res = widths(plotrect)
> prj_view = cam.projection[] * cam.view[] * Makie.transformationmatrix(scene)[]
> pix_space = prj_view * Vec4f(point[1], point[2], 0.0, 1.0)
> clip_space = (pix_space[1], pix_space[2])
> return ((clip_space .+ 1) ./ 2) .* cam_res .+ Makie.origin(plotrect)
> end
> 
> function update_scene(lm)
> l = length(lm)
> newx = zeros(l)
> newy = zeros(l)
> for i in 1:l
> (newx[i], newy[i]) = lm[i]
> end
> xpos[] = newx
> ypos[] = newy
> return
> end
> 
> getscreenpos(xy::Tuple, i::Integer) = to_screen(axscene, xy)[i]
> 
> function setpos(lm, x_or_y, listidx, i)
> newpos = [lm[listidx]...]
> newpos[i] = x_or_y
> lm[listidx] = (newpos...,)
> update_scene(lm)
> end
> 
> function setscreenpos(lm, x_or_y, listidx, i)
> axscreenpos = Point2f(x_or_y, x_or_y) .- Makie.origin(pixelarea(axscene)[])
> setpos(lm, to_world(axscene, axscreenpos)[i], listidx, i)
> end
> 
> addrole!(positionmodel, "xpos", xy -> xy[1], (lm, x_or_y, i) -> setpos(lm, x_or_y, i, 1))
> addrole!(positionmodel, "ypos", xy -> xy[2], (lm, x_or_y, i) -> setpos(lm, x_or_y, i, 2))
> addrole!(positionmodel, "xposscreen", xy -> getscreenpos(xy,1), (lm, x_or_y, i) -> setscreenpos(lm, x_or_y, i, 1))
> addrole!(positionmodel, "yposscreen", xy -> getscreenpos(xy,2), (lm, x_or_y, i) -> setscreenpos(lm, x_or_y, i, 2))
> 
> # Render function that takes a parameter t from a QML slider
> function render_function(screen)
> display(screen, figscene)
> if needupdate[] # The screen positions change if a resize happens and are unknown before the first render
> QML.force_model_update(positionmodel)
> needupdate[] = false
> end
> return
> end
> 
> QML.setGraphicsApi(QML.OpenGL)
> 
> loadqml(joinpath(pwd(), "code", "qml", "makie-plot.qml"),
> positionModel = positionmodel,
> updates = JuliaPropertyMap("needupdate" => needupdate),
> render_callback = @safe_cfunction(render_function, Cvoid, (Any,))
> );
> 
> exec()
> 
> ```

And System/Package info here:

> **Summary**
>
> ```julia
> julia> versioninfo()
> Julia Version 1.11.5
> Commit 760b2e5b739 (2025-04-14 06:53 UTC)
> Build Info:
> Official https://julialang.org/ release
> Platform Info:
> OS: Linux (x86_64-linux-gnu)
> CPU: 4 × Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz
> WORD_SIZE: 64
> LLVM: libLLVM-16.0.6 (ORCJIT, skylake)
> Threads: 1 default, 0 interactive, 1 GC (on 4 virtual cores)
> 
> (XXXX) pkg> st
> Status `XXXXXXXXXX`
> [ad839575] Blink v0.12.9
> [70588ee8] CSSUtil v0.1.1
> [336ed68f] CSV v0.10.15
> [1f15a43c] CxxWrap v0.16.2
> [3b531cbf] DataConvenience v0.3.6
> [a93c6f00] DataFrames v1.7.0
> [e9467ef8] GLMakie v0.11.5
> [5c1252a2] GeometryBasics v0.5.7
> [c601a237] Interact v0.10.5
> [ee78f7c6] Makie v0.22.4
> [510215fc] Observables v0.5.5
> [d96e819e] Parameters v0.12.3
> [a03496cd] PlotlyBase v0.8.21
> [f2990250] PlotlyKaleido v2.3.0
> [2db162a6] QML v0.9.2
> [2913bbd2] StatsBase v0.34.4
> [f3b207a7] StatsPlots v0.15.7
> 
> ```

Can anyone get that example running?

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [April 26, 2025, 6:42pm UTC](https://discourse.julialang.org/t/qml-jl-makie-plot-example-gives-multiple-errors/128444/2 "2025-04-26T18:42:23Z")

</div>

Which version of Makie are you using? QML is only compatible to version “0.17” of Makie.jl.

---

<div class="post-metadata">

**Author:** ![Tetrakai](https://avatars.discourse-cdn.com/v4/letter/t/4da419/32.png) [@Tetrakai](https://discourse.julialang.org/u/Tetrakai)\
**Post date:** [April 26, 2025, 6:43pm UTC](https://discourse.julialang.org/t/qml-jl-makie-plot-example-gives-multiple-errors/128444/3 "2025-04-26T18:43:59Z")

</div>

Looks like the latest: `Makie v0.22.4`

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [April 26, 2025, 6:45pm UTC](https://discourse.julialang.org/t/qml-jl-makie-plot-example-gives-multiple-errors/128444/4 "2025-04-26T18:45:16Z")

</div>

So this will not work. Try:

```julia
using Pkg
pkg"add Makie@0.17"

```

---

<div class="post-metadata">

**Author:** ![Tetrakai](https://avatars.discourse-cdn.com/v4/letter/t/4da419/32.png) [@Tetrakai](https://discourse.julialang.org/u/Tetrakai)\
**Post date:** [April 26, 2025, 6:52pm UTC](https://discourse.julialang.org/t/qml-jl-makie-plot-example-gives-multiple-errors/128444/5 "2025-04-26T18:52:01Z")

</div>

Thanks, I see it is kind of noted here:

> <https://github.com/barche/QmlJuliaExamples/blob/master/opengl/Project.toml>

I’ll try that in my project though. Is there anywhere I can read up on why?

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [April 26, 2025, 6:54pm UTC](https://discourse.julialang.org/t/qml-jl-makie-plot-example-gives-multiple-errors/128444/6 "2025-04-26T18:54:21Z")

</div>

> <https://github.com/JuliaGraphics/QML.jl/issues/173>
>
> Currently, \`QML.jl\` works well with \`GLMakie.jl\` v0.6 (and \`Makie.jl\` v0.17).
> B…ut not with the latest versions - \`GLMakie.jl\` v0.8 (and \`Makie.jl\` v0.19).
> 
> The error message is "\`GLScreen\` not defined".
> Hopefully, this is a rather small fix if you're familiar with the setup, but I'm not certain.
> 
> Later, it would also be nice to use the new Package Extensions rather than \`Requires.jl\` for Makie support - which among other things makes it possible to put compat bounds for Makie/GLMakie.

But, if you ask me, Makie has a breaking release every 3-6 months, and there is no way other projects can keep up with their changes.

---

<div class="post-metadata">

**Author:** ![Tetrakai](https://avatars.discourse-cdn.com/v4/letter/t/4da419/32.png) [@Tetrakai](https://discourse.julialang.org/u/Tetrakai)\
**Post date:** [April 26, 2025, 7:04pm UTC](https://discourse.julialang.org/t/qml-jl-makie-plot-example-gives-multiple-errors/128444/7 "2025-04-26T19:04:49Z")

</div>

Thanks, now it works. Note: the package manager downgraded StatsBase and some other Makie-related packages.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [April 26, 2025, 7:20pm UTC](https://discourse.julialang.org/t/qml-jl-makie-plot-example-gives-multiple-errors/128444/8 "2025-04-26T19:20:11Z")

</div>

Yes, downgrading is not always the best option. You must choose what is more important for you, using Makie in QML.jl or using the latest version of StatsBase.

---

<div class="post-metadata">

**Author:** ![Tetrakai](https://avatars.discourse-cdn.com/v4/letter/t/4da419/32.png) [@Tetrakai](https://discourse.julialang.org/u/Tetrakai)\
**Post date:** [April 26, 2025, 7:34pm UTC](https://discourse.julialang.org/t/qml-jl-makie-plot-example-gives-multiple-errors/128444/9 "2025-04-26T19:34:01Z")

</div>

So far QML.jl has been amazing with StatsPlots. Maybe this should be another topic but what currently works best with it for panning/zooming/3d plots?

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [April 26, 2025, 7:34pm UTC](https://discourse.julialang.org/t/qml-jl-makie-plot-example-gives-multiple-errors/128444/10 "2025-04-26T19:34:49Z")

</div>

Please, open a new topic for that.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [April 26, 2025, 8:12pm UTC](https://discourse.julialang.org/t/qml-jl-makie-plot-example-gives-multiple-errors/128444/11 "2025-04-26T20:12:57Z")

</div>

> [@ufechner7](#):
>
> there is no way other projects can keep up with their changes

To be fair, this particular integration was using more internal interfaces in GLMakie, so it’s expected to break easily. Usually, the breaking changes to public API in Makie are well documented and it should mostly not be difficult to adapt to them.
