Are you sure you're in the right directory?
Opening a file without a full path will open it in the current working directory. In most cases this is not what you want. Try changing the first line to
QString filename="c:\\Data.txt"
or
QString filename="c:/Data.txt"
and see if the file is created in c:\