1、首先是选择文件
QString file_path = QFileDialog::getOpenFileName(this, "请选择文件路径...", "默认路径(可选),"文件后缀可选TxT(*.txt)" );
if(file_path.isEmpty())
{ return; }
2、选择文件夹路径
QString file_path = QFileDialog::getExistingDirectory(this, "请选择文件夹路径...", "./");
if(file_path.isEmpty())
{ return; }