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::DesktopLocation | 0 | 桌面目录 |
QStandardPaths::DocumentsLocation | 1 | 文档目录。 |
QStandardPaths::FontsLocation | 2 | 字体的目录 |