I'm using the following code to the new property of the filedialog under QtQuick.Dialogs 1.3 & Qt 5.10.0. I've build it using Qt Creator 5.10 default kit.
import QtQuick 2.10
import QtQuick.Window 2.2
import QtQuick.Dialogs 1.3
Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
FileDialog {
id: fileDialog
title: "Please choose a file"
folder: shortcuts.home
defaultSuffix: "txt"
selectExisting: false
selectMultiple: false
onAccepted: {
console.log("You chose: " + fileUrl)
Qt.quit()
}
onRejected: {
console.log("Canceled")
Qt.quit()
}
Component.onCompleted: visible = true
}
}
My expectation are that if I choose a filename such as "MyFile", then the fileUrl would be "MyFile.txt". However it just returns "MyFile".
I have tested the code and it comes does come out with the ".txt". I am unsure of the problem but since there isn't really a question, you could append the default suffix using a global property.