目录
1.Qt与Halcon联合编程获取当前程序根目录
1、返回包含exe的目录(绝对路径)
QCoreApplication::applicationDirPath()
如D:/qt_coding/build/debug
2、返回exe可执行文件的路径(绝对路径)
qApp->applicationFilePath()
如D:/qt_coding/build/debug/test.exe
3、返回exe当前目录(绝对路径)
QString QDir::currentPath()
如D:/qt_coding/build
4、返回根目录的绝对路径
QString QDir::rootPath()
对于linux,返回"/"。对于Windows文件系统,通常返回“c:/”。
如C:/
5、返回用户主目录的绝对路径
QString QDir::homePath()
在Windows下,此函数将返回当前用户配置文件的目录
如C:/Users/Administrator
6、返回绝对路径
QString QDir::absolutePath() const
QString canonicalPath() const;
需要实例化QDir使用。