当前位置: 代码迷 >> 综合 >> QT-系统路径、exe、相对路径
  详细解决方案

QT-系统路径、exe、相对路径

热度:59   发布时间:2023-12-02 19:58:11.0
/**获取系统桌面路径* @time: 2019-7-5* @author: qiangu* @return: desktopPath*/
QString FileDirectory::getDesktopPath(){QString desktopPath = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);qDebug()<< "desktopPath:" << desktopPath;return desktopPath;}/**获取的执行文件exe所在的路径* @time: 2019-7-5* @author: qiangu* @return: applicationDirPath*/
QString FileDirectory::getApplicationDirPath(){// QString QApplication::applicationDirPath()QString applicationDirPath = QApplication::applicationDirPath();qDebug()<< "applicationDirPath:" << applicationDirPath;return applicationDirPath;}//相对路径,常用于资源文件。在QtCreater中的“./”这个路径是bulid directory的路径