QFileDialog to only show executable files in Linux
I have a QFileDialog that I want only to select executable files. Here is the code:
Code:
selectFile.
setFilter(QDir::Files |
QDir::Executable);
selectFile.setDirectory(path);
if (selectFile.exec())
qDebug() << selectFile.selectedFiles();
However I can see all files if I run it in Linux. Any idea how to correct it?
Re: QFileDialog to only show executable files in Linux
This is interesting, different implementations bahve differently.
With XDG_CURRENT_DESKTOP=KDE I get all files, as you do.
When I run this with XDG_CURRENT_DESKTOP=GNOME I get no files at all.
When I set the QFileDialog::Options to include DontUseNativeDialog I also get not files at all.
I added QDir::Readable to the filter, now GNOME and Non-Native dialog show programs, but seem to not show scripts that are marked executable.
Edit: ah, I think the two latter are actually the same thing (non-native dialog), just differently styled.
Cheers,
_