This is how you can set filters on your QStringList (filenames).
mylist << "*.jpg" << "*.bmp";
dir.setNameFilters(mylist);
QStringList mylist;
mylist << "*.jpg" << "*.bmp";
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).
tr
("Open Image"),
QDir::current().
dirName(), tr
("Image Files (*.jpg *.bmp)"));
QString mystring = QFileDialog::getOpenFileName(this,
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.
Bookmarks