Qt4使用 QDesktopServices::storageLocation(QDesktopServices::xxxx) 来获取一些系统目录,Qt5则要改成QStandardPaths::writableLocation(QStandardPaths::xxxx)


所需头文件:

[cpp] view plain copy
  1. #include <QDesktopServices>  

然后可以通过如下语句获取不同的路径:

[cpp] view plain copy
  1. QString QStandardPaths::writableLocation(StandardLocation type)  

也可以通过一下语句获取路径下的文件和文件夹:

[cpp] view plain copy
  1. QStringList QStandardPaths::standardLocations(StandardLocation type)  

参数为路径名字的指代值,列表如下:

C++学习之路(7)---Qt5获取系统目录

C++学习之路(7)---Qt5获取系统目录

相关文章:

  • 2022-12-23
  • 2021-10-05
  • 2021-07-17
  • 2021-08-18
  • 2021-12-16
  • 2022-12-23
  • 2021-11-04
猜你喜欢
  • 2021-12-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-10
  • 2021-10-05
相关资源
相似解决方案