I get the file path from Qml like this:
mainView.projectFilePath = Qt.resolvedUrl(newProjectFileDlg.fileUrl).toString();
The above file path looks like this: file:///C:/uuuu.a3
But when this path is passed to QFile, it complains
The filename, directory name, or volume label syntax is incorrect
How to solve this problem?
QString was not meant for a canonical url representation. It is a string class existing mostly due to the utf use cases.
What you are looking for is QUrl which was meant for use cases like this. Pass your path to that, and then get the "QFile-readable" path out of that, then pass it to QFile.
You will need to use the following method for the conversion before passing the path to QFile: