I have some problem with the loop. I'm trying to load img from browserfile and show others in 3s as image - slide. I used while loop
FileDialog {
id: fileDialog
visible: false
title: "Choose a file"
property url defaultz: "E:\IMG"
folder: defaultz
selectMultiple: true
nameFilters: [ "Image files (*.jpg *.png *.bmp)", "All files (*)" ]
onAccepted: {
console.log("You chose: " + fileDialog.fileUrls)
console.log(fileDialog.fileUrls.length)
click.visible = false
//title.visible = false
while(i<fileDialog.fileUrls.length){
loop()
}
}
onRejected: {
console.log("Canceled")
fileDialog.visible = false
click.visible = false
}
Component.onCompleted: visible = false
}
Image {
id: show
visible: false
x:0
y:0
width: 300
height: 300
Timer{
id: tmr
interval: 5000
running: false
repeat: false
onTriggered: {
show.visible = false
}
}
}
function loop(){
show.source = fileDialog.fileUrls[i]
show.visible = true
tmr.running = true
i++
}
When loop()
is called, it will run show.source = fileDialog.fileUrls[i]
to stopped. After that, show.visible = true
and tmr.running
will be called.
Someone help me please?