Hi Davide,
Just checked some simple demo for fileUtils and, it looks like, it works.
import Felgo 3.0
import QtQuick 2.0
App {
// You get free licenseKeys from http://felgo.com/licenseKey
// With a licenseKey you can:
// * Publish your games & apps for the app stores
// * Remove the Felgo Splash Screen or set a custom one (available with the Pro Licenses)
// * Add plugins to monetize, analyze & improve your apps (available with the Pro Licenses)
//licenseKey: "<generate one from http://felgo.com/licenseKey>"
NavigationStack {
Page {
title: qsTr("Main Page")
Column {
width: parent.width
TextEdit {
id: editableArea
width: parent.width
height: 300
text: "Hello, start typing here ..."
font.family: "Helvetica"
font.pointSize: 20
color: "blue"
focus: true
}
Rectangle {
color: 'blue'
width: 150
height: 50
radius: 25
x: parent.x / 2
Text {
text: 'Save current text'
anchors.centerIn: parent
color: '#fff'
}
MouseArea {
anchors.fill: parent
onClicked: {
fileUtils.writeFile(Qt.resolvedUrl("newFile.txt"), editableArea.text)
fileContentArea.readCurrentFileConent()
}
}
}
TextEdit {
id: fileContentArea
readOnly: true
text: 'Loading ....'
function readCurrentFileConent() {
fileContentArea.text = fileUtils.readFile(Qt.resolvedUrl("newFile.txt"))
}
Component.onCompleted: {
readCurrentFileConent()
}
}
}
}
}
}
Looks like, by default, Qt searches relatively from to the fiel from which you use the method.
I created new project Qt Apps, and just changes Main.qml.
The file I edit is in qml/newFile.txt , relatively to Main.qml which is also in qml/Main.qml
Try this one, maybe will help you