注: 本次的程序目录为"E:/QTTest/Test",编译只选择了release
QCoreApplication::applicationDirPath()的返回路径为包含可执行程序的目录
QDir::currentPath()的返回路径为程序文件存放的目录
验证程序:
QString exePath = QCoreApplication::applicationDirPath();
qDebug()<<exePath;
QString path = QDir::currentPath();
qDebug()<<path;
输出:
“E:/QTTest/Test/release”
“E:/QTTest/Test”