0、头文件中加入
public: QString fileName; public slots: void showImage();
1、添加两个头文件
#include<qfiledialog.h>
#include<qstring.h>
2、QFileDialog::getOpenFileName
槽函数中加入:
QString lastPath="D:\Englishpath\QTprojects\DATA\videoData"; QString fileName = QFileDialog::getOpenFileName(this, tr("打开文件"), lastPath);
connect:
connect(ui->m_openFile,SIGNAL(clicked(bool)),this,SLOT(showImage()));