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)  

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

Qt5获取系统目录

Qt5获取系统目录


参考资料:http://blog.csdn.net/vinson0526

相关文章:

  • 2021-10-05
  • 2021-11-29
  • 2021-12-09
  • 2022-12-23
  • 2021-07-30
  • 2021-11-29
  • 2022-01-22
  • 2021-08-18
猜你喜欢
  • 2021-04-14
  • 2021-10-05
  • 2022-12-23
  • 2021-07-16
  • 2022-12-23
  • 2022-12-23
  • 2021-12-09
相关资源
相似解决方案