QT版本: 5.12.6
#include <QStandardPaths>
示例代码:
qDebug()<<"系统字体目录路径:"<<QStandardPaths::standardLocations(QStandardPaths::FontsLocation); qDebug()<<"系统桌面目录路径:"<<QStandardPaths::standardLocations(QStandardPaths::DesktopLocation); qDebug()<<"用户文档目录路径:"<<QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation); qDebug()<<"用户音乐目录路径:"<<QStandardPaths::standardLocations(QStandardPaths::MusicLocation); qDebug()<<"用户图片目录路径:"<<QStandardPaths::standardLocations(QStandardPaths::PicturesLocation); qDebug()<<"系统临时文件目录路径:"<<QStandardPaths::standardLocations(QStandardPaths::TempLocation); qDebug()<<"系统缓存目录路径:"<<QStandardPaths::standardLocations(QStandardPaths::CacheLocation); qDebug()<<"系统下载目录路径:"<<QStandardPaths::standardLocations(QStandardPaths::DownloadLocation); qDebug()<<"系统缓存目录路径:"<<QStandardPaths::standardLocations(QStandardPaths::CacheLocation);
MacOS与Windows系统的目录路径说明:
Linux系统的目录路径说明:
Android、IOS系统的目录路径说明:
每个枚举的功能介绍: