下面的代码以前工作过,但对我来说不再工作了,原因不明:
import QtQuick 2.2
import QtQuick.Dialogs 1.0
FileDialog {
id: fileDialog
title: ""
folder: "file:///home"
signal file_opened(var filename)
onAccepted: {
file_opened(fileDialog.fileUrls)
fileDialog.close()
}
Component.onCompleted: visible = true
}
我正在使用shortcuts.home
但这也停止工作。以上有什么内在的问题吗?
您需要打开对话框:
Component.onCompleted: open()
并删除其他答案提到的 close(( 调用。