QQuickImageProvider equivalent in slint? #2712
-
Hi, What's the best way to provide images to slint Image ui element? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Images are specified with the The documentation linked above has examples how to create If you repeatedly call Once a |
Beta Was this translation helpful? Give feedback.
Images are specified with the
source
property. You can either supply that give the literal@image-url("string literal path to image here")
or you can programmatically createslint::Image
objects in Rust and C++ and assign them to thesource
property. The type of thesource
property isimage
, which maps toslint::Image
.The documentation linked above has examples how to create
slint::Image
objects from pixel buffers. Those are shared by reference count. Both, in Rust and C++,slint::Image
can also be created from a path to an image file on disk, usingload_from_path()
.If you repeatedly call
slint::Image::load_from_path()
with the same path, it will only load the image from disk the first …