Qt-UI

Q File Dialog

QLineEdit | | QSplitter

QStringList browse(QString title,
                   QString path,
                   bool newfile)
{
   QFileDialog* fd = new QFileDialog(this, title);
   if (fd == NULL) MEMERROR();

   if (!newfile) fd->setFileMode(QFileDialog::ExistingFiles);
   else fd->setFileMode(QFileDialog::AnyFile);
   fd->setViewMode(QFileDialog::List);
   if (newfile) fd->setAcceptMode(QFileDialog::AcceptSave);
   fd->setFilter("All Files (*.*);;Images (*.tif *.tiff *.jpg *.png)");

   if (path!="") fd->setDirectory(path);

   QStringList files;

   if (fd->exec() == QDialog::Accepted)
      for (int i=0; i<fd->selectedFiles().size(); i++)
      {
         QString fileName = fd->selectedFiles().at(i);

         if (!fileName.isNull())
            files += fileName;
      }

   delete fd;

   return(files);
}


QLineEdit | | QSplitter

Options: