diff --git a/.gitignore b/.gitignore index f6b2b20..a1565c0 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ CMakeLists.txt.user /Manifest.toml /docs/build +.vscode diff --git a/src/itemmodel.jl b/src/itemmodel.jl index ba290f2..3c29f40 100644 --- a/src/itemmodel.jl +++ b/src/itemmodel.jl @@ -8,6 +8,7 @@ Base.:+(a::QML.ItemDataRole, b::Integer) = convert(Int32,a) + b # Allow roles as keys in Dicts: Base.trailing_zeros(role::ItemDataRole) = Base.trailing_zeros(convert(Int32,role)) Base.:(>>)(a::ItemDataRole, b::Int64) = convert(Int32, a) >> b +Base.:(>>)(a::ItemDataRole, b::Int32) = convert(Int32, a) >> b mutable struct ItemModelData{DataT} values::Observable{DataT} roles::RoleNames diff --git a/test/containers.jl b/test/containers.jl index 9ee542b..2a3f386 100644 --- a/test/containers.jl +++ b/test/containers.jl @@ -44,12 +44,12 @@ let h = QML.QHash{Int32,QML.QByteArray}() @test isempty(h) end -let numbers = Int32[1,2,3,4], model = JuliaItemModel(numbers) +let numbers = [1,2,3,4], model = JuliaItemModel(numbers) modeldata = QML.get_julia_data(model) @test QML.rowcount(modeldata) == 4 @test QML.colcount(modeldata) == 1 @test QML.value(QML.data(modeldata, QML.DisplayRole,3,1)) == "3" - @test QML.setdata!(model, QVariant(Int32(5)), QML.EditRole, 3, 1) + @test QML.setdata!(model, QVariant(5), QML.EditRole, 3, 1) @test QML.value(QML.data(modeldata, QML.DisplayRole,3,1)) == "5" @test QML.value(QML.headerdata(modeldata, 2, QML.Vertical, QML.DisplayRole)) == 2 @test_logs (:warn,"Setting header data is not supported in this model") QML.setheaderdata!(model, 1, QML.Vertical, QML.EditRole, "One")