How to load bunch of images to the Image in QML?
-
You can use Movie element. But it's also possible with Image combined with Timer. A quick example (brain to terminal):
@
Image {
property int picNumber: 0id: image
source: "img" + picNumber + ".png"
}Timer {
interval: 100
running: true
repeat: trueonTriggered: {
image.picNumber++;
}
}
@ -
Thank you, sierdzio. Now it looks so clear :) I'm not good at timers yet. It works of course, but I've got 36 pictures and they are really big so everything takes too much time. I thought about mix the QML with C++ but I don't know if it would be too difficult for the beginning.
-
If they are big, then you should probably go into converting them into a movie and then playing it back in your app. Video codecs are optimised to handle those situations well, timely and with small CPU/ RAM footprint. QML Image is really meant for displaying static images. My solution above will work, of course, but I would only consider using this approach for some small, corner use cases.