QT软件开发: 获取下载、桌面、临时文件....等系统默认目录

简介: QT软件开发: 获取下载、桌面、临时文件....等系统默认目录

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系统的目录路径说明:

image.png

image.png

Linux系统的目录路径说明:

image.png

Android、IOS系统的目录路径说明:

image.png

每个枚举的功能介绍:

image.png

image.png



目录
相关文章
【qt】如何读取文件并拆分信息?
【qt】如何读取文件并拆分信息?
426 0
|
存储 Windows
(13) Qt事件系统(two)
文章详细介绍了Qt事件系统,包括事件分发、自定义事件、事件传播机制、事件过滤以及事件与信号的区别。
1101 3
(13) Qt事件系统(two)
|
编解码 程序员
(12)Qt事件系统(one)
本文详细介绍了Qt事件系统,包括各种系统事件、鼠标事件、键盘事件、定时器等的处理方法和示例代码。
789 0
(12)Qt事件系统(one)
|
API
Qt绘图之Paint系统
Qt绘图之Paint系统
418 2
QT 软件打包为一个单独可执行.exe文件流程
QT 软件打包为一个单独可执行.exe文件流程
3023 0
从源码角度分析Qt元对象系统2
从源码角度分析Qt元对象系统
360 0
|
存储
从源码角度分析Qt元对象系统1
从源码角度分析Qt元对象系统
453 0
|
数据安全/隐私保护
【qt】考试系统项目
【qt】考试系统项目
411 0
|
安全 C++ Windows
Windows下C++使用gRPC(Qt和VS,含文件包和使用方法)
Windows下C++使用gRPC(Qt和VS,含文件包和使用方法)
|
数据安全/隐私保护
【qt】获取主机信息系统
【qt】获取主机信息系统
209 0

推荐镜像

更多
  • qt