-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restrict JuliaItemModel constructor to match documentation and behavior #205
Comments
As a sidenote, I did some type piracy to support the function QML.JuliaItemModel(obs::Observable{T}) where {T<:AbstractArray}
model = JuliaItemModel(obs[])
on(obs) do data
values(model)[] = data
QML.force_model_update(model)
end
return model
end I don't know if this implementation has pitfalls; maybe it can be improved. I could work on a PR if you think this use case is worth supporting. |
Thanks for the comments. I think we should actually update the documentation, since it is not strictly needed for the data to be an array, for example it can be a I'm not sure about pitfalls in passing an observable, but note that |
Thanks for the clarification. I am aware that That is, For some context, my use case involves repeatedly populating a Anyways, bridging observable I think this issue, the way I phrased it, is adequately solved by clarifying the documentation. As far as I can tell, the methods operating on And to end on a positive note; I have to say that QML on the whole has been a joy to use. Bridging Observables and Makie to Qt is magical :-) |
The manual states that
JuliaItemModel
is constructed from a 1D Julia array, but the method currently silently accepts types that are not arrays, without producing aMethodError
immediately (as i believe it should since the argument actually needs to be an array) only to then fail down the line. For example:I'm wondering if
JuliaItemModel
method should be restricted to work only with types which areAbstractArray
?Perhaps more insidiously, things that in principle are natural, such as
are accepted, but fails down the line, without making the root cause clear.
The text was updated successfully, but these errors were encountered: