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
sourceproperty. You can either supply that give the literal@image-url("string literal path to image here")or you can programmatically createslint::Imageobjects in Rust and C++ and assign them to thesourceproperty. The type of thesourceproperty isimage, which maps toslint::Image.The documentation linked above has examples how to create
slint::Imageobjects from pixel buffers. Those are shared by reference count. Both, in Rust and C++,slint::Imagecan 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 …