当前位置:网站首页>【Qt】Qt获取标准系统路径

【Qt】Qt获取标准系统路径

2022-06-22 12:04:00 郭老二

1、返回可写的指定标准路径

2.1 返回桌面路径

QString path = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);

2.2 返回用户主目录

QString path = QStandardPaths::writableLocation(QStandardPaths::HomeLocation);

2.3 返回临时文件目录

QString path = QStandardPaths::writableLocation(QStandardPaths::TempLocation);

2、全部标准系统路径

QStandardPaths::StandardLocation

类型说明
QStandardPaths::DesktopLocation0桌面目录
QStandardPaths::DocumentsLocation1文档目录。
QStandardPaths::FontsLocation2字体的目录
QStandardPaths::ApplicationsLocation3应用程序目录。
QStandardPaths::MusicLocation4音频目录。
QStandardPaths::MoviesLocation
原网站

版权声明
本文为[郭老二]所创,转载请带上原文链接,感谢
https://blog.csdn.net/u010168781/article/details/125384608