@image-url
from a property<string>
#3437
-
Should be possible to do something like:
This is returning Is there a way to set the string of the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi! You can use the C++ and Rust APIs of That means that you can correctly compute the absolute path at runtime and handle errors if the file does not exist. In theory we could allow arbitrary strings at runtime, but I feel that should use a function instead of a macro ( |
Beta Was this translation helpful? Give feedback.
Hi! You can use the C++ and Rust APIs of
slint::Image
to load an image at runtime from a path, and then set the image property.That means that you can correctly compute the absolute path at runtime and handle errors if the file does not exist.
In theory we could allow arbitrary strings at runtime, but I feel that should use a function instead of a macro (
@image-url
), we would have to decide how to handle relative paths, we might need API to construct paths, and introduce features to make error handling ergonomic. That would seem like a direction to me that's closer to business logic, which I think we may want to minimize in .Slint files, also to keep them toolable.