Windows Path Variables:
My Computer (already included by default)
Desktop: %USERPROFILE%\Desktop
Drive C: %SystemDrive%
My Documents: (VARIES) - Windows Vista/7/8: %USERPROFILE%\Documents - Windows XP: "%USERPROFILE%\My Documents"
My Music: (SAME AS My Documents, respectively)
My Pictures: (SAME AS My Documents, respectively)
My Videos: (SAME AS My Documents, respectively)
My Downloads: - Usually %USERPROFILE%\Downloads, but older versions of Windows also used My Documents\Downloads.
home folder (already included by default)
举例:
打开桌面: (WIN7下)
QString _document = QProcessEnvironment::systemEnvironment().value("USERPROFILE")+"\\Desktop";
const QStringList fileNames = QFileDialog::getOpenFileNames(this,
QString::fromLocal8Bit("打开文件"), _document,
QString::fromLocal8Bit("图片文件(*.jpg;*.png;*.bmp;*.gif;)"));