This is how you can set filters on your QStringList (filenames).
Qt Code:
  1. QStringList mylist;
  2. mylist << "*.jpg" << "*.bmp";
  3. dir.setNameFilters(mylist);
To copy to clipboard, switch view to plain text mode 
This is how you can set filters on your QString (filenames of a given folder).
Qt Code:
  1. QString mystring = QFileDialog::getOpenFileName(this,
  2. tr("Open Image"), QDir::current().dirName(), tr("Image Files (*.jpg *.bmp)"));
To copy to clipboard, switch view to plain text mode 

I wonder if it is also possible to set negative filters? Instead of declaring what you want to see, I'd like to declare what I DON'T want to see? Does anyone know the syntax? For example: I don't want to see a file named "file.bmp", but "*.bmp" is allowed.