Qt conversion between absolute path and relative path strength

Absolute path

The real location of the file

relative path

Relative to the location of the target file,

Features

Realize the arbitrary drag of the folder without affecting the execution of the program

//绝对路径
getLine(QString("C:/Users/12845/Desktop/CYS_design/0825_data/GYB/GYB-16Ziz.txt"), this->gyb_16_Ziz);
//相对路径——pro文件
//定位到项目文件夹
DESTDIR += ../0315demo_magnetic/


getLine(QDir::currentPath().append("/0825_data/GYB/GYB-16Ziz.txt"), this->gyb_16_Ziz);

Guess you like

Origin blog.csdn.net/qq_43641765/article/details/115079026