I’m trying to run this (pasting in the REPL):
First error occurs on using GLMakie
:
Summary
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
andVec4f
Fourth error is on loadqml
and/or exec
:
Summary
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. Ifexec
is run anyway I get the above error.
My attempted fixes are in this script:
Summary
# 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> 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?