QFile is the class that does data I/O.
If you only need a reference to the file use either QString or QFileInfo.

If you need the file, e.g. when you function does more than just create the instance, then return a smart pointer

Qt Code:
  1. QSharedPointer<QFile> MyClass:getFile()
  2. {
  3. // ....
  4.  
  5. QSharedPointer<QFile> file(new QFile(filename);
  6. file->open(...); // or other tasks with file
  7.  
  8. return file;
  9. }
To copy to clipboard, switch view to plain text mode 

Cheers,
_