PDA

View Full Version : Are "negative filters" possible??



ht1
30th November 2007, 20:43
This is how you can set filters on your QStringList (filenames).


QStringList mylist;
mylist << "*.jpg" << "*.bmp";
dir.setNameFilters(mylist);

This is how you can set filters on your QString (filenames of a given folder).


QString mystring = QFileDialog::getOpenFileName(this,
tr("Open Image"), QDir::current().dirName(), tr("Image Files (*.jpg *.bmp)"));


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.

jpn
30th November 2007, 21:23
Take a look at QStringList::filter().