QString str =QCoreApplication::applicationDirPath();
QString strPathTmp =QCoreApplication::applicationDirPath() + QDir::separator();
strImagePath =QDir::toNativeSeparators( strPathTmp );
str:D:/208/OSGDemo../bin
strPathTmp: D:/208/OSGDemo../bin\
strImagePath:D:\208\OSGDemo..\bin\
说明:
QCoreApplication::applicationDirPath();//获得当前执行文件所在路径上一级目录
QDir::separator();//执行结果为“\”
QDir::toNativeSeparators( strPathTmp );//执行结果为将“/”改为“\”
其中:QApplication-->QCoreApplication-->QObject
-->继承关系
此篇博客待补充。