currently I use QT .I call QFileDialog::getOpenFileName,but I can’t get the path of file.after I try to change the code to GB2312 buf I still cant get Chinese Path;And every call the function the out window show a lot of Garbled.Here is the code and picture
#include<QFileDialog>
#include<QTextCodec>
void MainDialog::slot_uploadFile(bool flag)
{
qDebug()<<__func__;
//弹出窗口 选择文件
QString path=QFileDialog::getOpenFileName(this,"选择文件","./");
QTextCodec *code=QTextCodec::codecForName("GB2312");
std::string pathName=code->fromUnicode(path).data();
if(path.isEmpty()) return ;
//发送信号
QString dir=ui->lb_path->text();
//发送信号 核心类处理 传递的信息:上传到什么文件到 什么目录下
qDebug()<<dir;
Q_EMIT SIG_uploadfile(QString::fromStdString(pathName),dir);
}
enter image description here
I can’t understand the output of the system,I want to know what to do it by using QT.Or other function I can use. Thank you!!!!