QT 获取当前项目可执行文件路径
2021/7/29 23:35:51
本文主要是介绍QT 获取当前项目可执行文件路径,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
#include <QCoreApplication> QString strDirPath = QCoreApplication::applicationDirPath(); QString strFilePath = QCoreApplication::applicationFilePath();
Tips:
-
QCoreApplication::applicationDirPath()
Returns the directory that contains the application executable.
返回包含当前项目的可执行文件的路径; -
QCoreApplication::applicationFilePath();
Returns the file path of the application executable.
返回可执行文件的路径
e.g.:
可执行文件的的路径为"/home/MonroeLiu/project/test/bin/executable.exe";
则:
strDirPath = "/home/MonroeLiu/project/test/bin"; strFilePath = "/home/MonroeLiu/project/test/bin/executable.exe";
这篇关于QT 获取当前项目可执行文件路径的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-09-20接口模块封装入门教程
- 2024-09-20请求动作封装入门教程
- 2024-09-20登录鉴权学习:新手入门教程
- 2024-09-20后台管理开发学习:新手入门指南
- 2024-09-20后台管理系统开发学习:从入门到实践
- 2024-09-20后台开发学习:从入门到初级实战指南
- 2024-09-20后台综合解决方案学习:从入门到实践
- 2024-09-20接口模块封装学习入门指南
- 2024-09-20请求动作封装学习:新手入门教程
- 2024-09-20登录鉴权入门:打造安全的用户认证系统