QT笔记之QFileDialog

就是平时打开文件时看到的对话框,这里只是简单的演示,并非真正的打开

void MainWindow::open()
{
    QString path=QFileDialog::getOpenFileName(this,tr("Open file"),".",tr("*.dll *.txt *.jpg *.png"));
    if(path.length()==0)
    {
        QMessageBox::information(NULL,tr("Info"),tr("You select anything"));
    }
    else
    {
     QMessageBox::information(NULL, tr("Info"),tr("You select ") + path);
    }
}

QT笔记之QFileDialog_第1张图片


你可能感兴趣的:(File,null,qt,Path)