Qt4使用 QDesktopServices::storageLocation(QDesktopServices::xxxx) 来获取一些系统目录,Qt5则要改成 QStandardPaths::writableLocation(QStandardPaths::xxxx)。
所需头文件:
#include <QDesktopServices>
然后可以通过如下语句获取不同的路径:
QString QStandardPaths::writableLocation(StandardLocation type)
也可以通过一下语句获取路径下的文件和文件夹:
QStringList QStandardPaths::standardLocations(StandardLocation type)
参数为路径名字的指代值,列表如下:

Ubuntu 环境下Gtk与QT编译环境安装与配置 http://www.linuxidc.com/Linux/2013-08/88539.htm
Linux系统下QT环境搭建 http://www.linuxidc.com/Linux/2013-07/87576.htm
Ubuntu下QT控制台程序无法运行的解决方案以及XTerm的配置方法 http://www.linuxidc.com/Linux/2013-06/86244.htm
Ubuntu 10.04下QT4.7.4移植详解 http://www.linuxidc.com/Linux/2013-01/77930.htm
Ubuntu 14.04下安装部署Qt5开发环境 http://www.linuxidc.com/Linux/2014-05/101774.htm
本文永久更新链接地址:http://www.linuxidc.com/Linux/2015-09/123101.htm
