In a sandboxed Qt app on Mac OS X Lion, the application data folder sits within the sandbox container. The path looks like this: ~/Library/Containers/bundleID/Data/Library/Application Support/CompanyName/ApplicationName/ . I would like to open a save file dialog and set its default folder to ~/Library/Containers/bundleID/Data/Library/Application Support/CompanyName/ApplicationName/folder1. The code I use is:

QString sPath=QFileDialog::getSaveFileName(this,tr("Save File"),"~/Library/Containers/bundleID/Data/Library/Application Support/CompanyName/ApplicationName/folder1/untitled.txt",tr("text files (*.txt"));

However, when the dialog is opened, the default path is changed to "~/Library/Application Support/CompanyName/ApplicationName/folder1/", which is exactly the same path in the application folder before sandbox is applied. It seems the QFileDialog::getSaveFileName function automatically converts a path from the sandboxed version to the unsandboxed version. That creates a problem for our particular application.

By the way, if I use the option QFileDialog:oNotUseNativeDialog, the path won't be automatically converted.