QML and Examples not working

The discussion on GUI’s and in particular QML made me interested in trying it out to get a flavour of what it does and how to do it. So I went to the QML.jl page to try some examples. The first time through the gui.jl example ran fine.

Then I started running into problems. Now what I get is shown below. I am running this on Windows 11.

Any suggestions?

PS C:\data\st\Julia\QML\QmlJuliaExamples\basic> julia --project=.
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.11.2 (2024-12-01)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> using QML
Precompiling QML...
  25 dependencies successfully precompiled in 19 seconds. 63 already precompiled.
ERROR: InitError: type RefArray has no field cpp_object
Stacktrace:
  [1] getproperty
    @ .\Base.jl:49 [inlined]
  [2] unsafe_convert(to_type::Type{CxxWrap.CxxWrapCore.CxxPtr{…}}, x::Base.RefArray{Ptr{…}, Vector{…}, Vector{…}})
    @ CxxWrap.CxxWrapCore C:\Users\jakez\.julia\packages\CxxWrap\5IZvn\src\CxxWrap.jl:271
  [3] getargv(a::QML.ArgcArgv)
    @ QML C:\Users\jakez\.julia\packages\QML\ZVeBh\src\QML.jl:133
  [4] __init__()
    @ QML C:\Users\jakez\.julia\packages\QML\ZVeBh\src\QML.jl:156
  [5] run_module_init(mod::Module, i::Int64)
    @ Base .\loading.jl:1378
  [6] register_restored_modules(sv::Core.SimpleVector, pkg::Base.PkgId, path::String)
    @ Base .\loading.jl:1366
  [7] _include_from_serialized(pkg::Base.PkgId, path::String, ocachepath::String, depmods::Vector{…}, ignore_native::Nothing; register::Bool)
    @ Base .\loading.jl:1254
  [8] _include_from_serialized (repeats 2 times)
    @ .\loading.jl:1210 [inlined]
  [9] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt128, stalecheck::Bool; reasons::Dict{…}, DEPOT_PATH::Vector{…})
    @ Base .\loading.jl:2057
 [10] _require(pkg::Base.PkgId, env::String)
    @ Base .\loading.jl:2527
 [11] __require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base .\loading.jl:2388
 [12] #invoke_in_world#3
    @ .\essentials.jl:1089 [inlined]
 [13] invoke_in_world
    @ .\essentials.jl:1086 [inlined]
 [14] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base .\loading.jl:2375
 [15] macro expansion
    @ .\loading.jl:2314 [inlined]
 [16] macro expansion
    @ .\lock.jl:273 [inlined]
 [17] __require(into::Module, mod::Symbol)
    @ Base .\loading.jl:2271
 [18] #invoke_in_world#3
    @ .\essentials.jl:1089 [inlined]
 [19] invoke_in_world
    @ .\essentials.jl:1086 [inlined]
 [20] require(into::Module, mod::Symbol)
    @ Base .\loading.jl:2260
during initialization of module QML
Some type information was truncated. Use `show(err)` to see complete types.

Did you start Julia with:

julia --project

?
Did you run:

using Pkg
Pkg.update()

?
For the basic examples you might have to change Project.toml to look like this:

[deps]
ColorTypes = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
CxxWrap = "1f15a43c-97ca-5a2a-ae31-89f07a497df4"
Observables = "510215fc-4207-5dde-b226-833fc4488ee2"
QML = "2db162a6-7e43-52c3-8d84-290c1c42d82a"
ResumableFunctions = "c5292f4c-5179-55e1-98c5-05642aab7184"

[compat]
ColorTypes = "0.11"
CxxWrap = "0.16"
QML = "0.9"
julia = "1.6"

Only required for Julia 1.11, not required for Julia 1.10.

See: Update README.md, bump dependencies by ufechner7 · Pull Request #15 · barche/QmlJuliaExamples · GitHub

The only ones I needed to change were

CxxWrap = "0.16"     # from 0.14
QML = "0.9"          # from 0.8
1 Like