Filtering executable files in QFileDialog on Linux

前端 未结 1 882
不知归路
不知归路 2021-01-19 23:58

I am trying to make a file picker to select a program (executable file).

My understanding of the documentation for QDir and QFileDialog is that the following should

相关标签:
1条回答
  • 2021-01-20 00:25

    I am using PyQt5 but had to do a similar thing only I wanted just .txt files. To perform this I used getFileOpenName() and the filter= option. It worked fine for my purposes. The function names have changed from PyQt4 to PyQt5, but the link below has the names of the PyQt4 alternatives.

    http://pyqt.sourceforge.net/Docs/PyQt5/pyqt4_differences.html

    The getOpenFileNameAndFilter(), getOpenFileNamesAndFilter() and getSaveFileNameAndFilter() methods of PyQt4’s QFileDialog have now been renamed getOpenFileName(), getOpenFileNames() and getSaveFileName() respectively in PyQt5. PyQt4’s implementations of getOpenFileName(), getOpenFileNames() and getSaveFileName() are not supported in PyQt5.

    0 讨论(0)
提交回复
热议问题