@HenrikSt.
You got a number of different possibilities suggested. Possibly you are overwhelmed by the different things. Sometimes it is hard for the people answering to know where the real problem was/is.
I am not sure now if this might be too detailed for you. Anyway I move forward.
I would suggest, if you have not done yet, The example from QFile as also listed by @jsulm and play a bit around. Just change the file name to somthing you need. E.g.
QFile file("c:/data/myNewFolder/out.txt");
That is a possibility to specify a complete (absolute) file name.
If you are a beginner, I was in that stage before as all the others, there might be a problem with the not existing folder name, if your file not created. There is QDir::mkPath, which is slightly different from mkDir. It may help you in code to ensure that you actually can create the file.
The other thing driving me personally nuts is the stupid folder separator for windows, which is a back slash '\'. However, in the mean time you can easily substitute with a forward slash also for most things in Windows (especially Qt). This also part of some of the suggestions.
If you have difficulties sometimes it helps for others to post a short section of code and the error message.