filedialog可以实现在qml上编写直接调用已有的文件夹进行调用实现读写,也可以保存没有的文件
官方示例
一:
FileDialog {
id: fileDialog
title: "Please choose a file"
folder: shortcuts.home
onAccepted: {
console.log("You chose: " + fileDialog.fileUrls)
Qt.quit()
}
onRejected: {
console.log("Canceled")
Qt.quit()
}
Component.onCompleted: visible = true
}
folder是用户选择的文件夹
二:
FileDialog {
nameFilters: [ "Image files (*.jpg *.png)", "All files (*)" ]
}
nameFilters是文件过滤列表