PDA

View Full Version : QFileDialog filter



wirasto
13th October 2009, 04:58
How to filter only execuatable files in Linux ?

yogeshgokul
13th October 2009, 06:21
Set following property before displaying file dialog.

QFileDialog::setFilter(QDir::Executable)

wirasto
13th October 2009, 07:46
Not work. Is something wrong with my code ?


QFileDialog open;
open.setFilter(QDir::Executable);
QString fileName = open.getOpenFileName(this, tr("Open Binary File"), QDir::homePath());

Boron
13th October 2009, 16:37
The Qt documentation says that QDir::Executable needs to be combined with QDir:: Dirs or QDir::Files.
Read the docs about QFileDialog::setFilter(...)!

wirasto
14th October 2009, 19:09
open.setFilter(QDir::Files | QDir::Executable);


Still not work :(
Have any suggestion ?

axeljaeger
15th October 2009, 11:49
Does anything happen when setting the filter? Does any other filter work for you?

wirasto
15th October 2009, 14:33
Nothing :crying:
And I don't know why... :crying:

MarkoSan
24th November 2009, 15:42
How do I set filter for retrieving list of files of type *.png AND *.jpg (or many more pic formats)?

Boron
24th November 2009, 21:22
Have a look at the "Detailed Description" of QFileDialog. There you will find an example for multiple filters.

sudhansu
20th January 2010, 06:41
Not work. Is something wrong with my code ?


QFileDialog open;
open.setFilter(QDir::Executable);
QString fileName = open.getOpenFileName(this, tr("Open Binary File"), QDir::homePath());

Hi I'm also trying to do same kind of application. like openig a file dialog which should show only executable. But unfortunatly filter is not working. I did same way as above. Can any body tell how to solve it.
I'm doing it in Linux.

Thank you all.

Lykurg
20th January 2010, 07:21
Ok, now I see this post of yours with the same topic... It is because:
QDir::Executable 0x040 List files for which the application has execute access. The Executable value needs to be combined with Dirs or Files.

sudhansu
20th January 2010, 08:50
QDir::Executable 0x040 List files for which the application has execute access. The Executable value needs to be combined with Dirs or Files.

Hi Lykurg, Can u plz tell me how to combined the Executable valus?? :(

Lykurg
20th January 2010, 12:40
You have to use the bit operators like | & ^ ~. E.g. use QDir::Files | QDir::Executable.