获取Qt应用程序路径.md 306 B

#qt

代码参考

   // 获取应用程序的目录路径
   QString appDirPath = QCoreApplication::applicationDirPath();

   // 使用QDir构建文件路径
   QDir dir_1(appDirPath);
   QString absoluteFilePath = dir_1.filePath("");

   qDebug() << "Absolute file path:" << absoluteFilePath;