【发布时间】:2018-08-03 11:30:47
【问题描述】:
我的循环有问题。我正在尝试从浏览器文件加载 img 并在 3 秒内将其他人显示为图像 - 幻灯片。我使用了while循环
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++
}
当loop()被调用时,它会运行show.source = fileDialog.fileUrls[i]来停止。之后,show.visible = true 和 tmr.running 将被调用。
有人帮帮我吗?
【问题讨论】:
-
您的问题缺少您遇到的实际问题。
标签: qt qml filedialog