QDir dir("D:/proba/pr_scr/screens"); if (!dir.exists()) ui.lineEdit1->setText("Cannot find the example directory"); else ui.lineEdit1->setText("find the directory"); QString fileName=QFileDialog::getOpenFileName(this, tr("Open File"),"D:/proba/pr_scr/screens",tr("*.jpg *.jpeg"));