In general translating a function from Qt to PyQt5 is trivial as you show with some of the arguments but others must understand the logic of the function. That is the case of the "selectedFilter" argument that returns the filter used in the selection of the file. In C ++, unlike Python, you can only return a value so a trick to return other values is to use pointers, and that is the current case, but in python you can return a tuple, so it is handled in this case :
filename, selectedFilter = QtWidgets.QFileDialog.getOpenFileName(...)
On the other hand, a simpler way to handle the PyQt5 docs is to use the python "help":
$ python
>>> from PyQt5 import QtWidgets
>>> help(QtWidgets.QFileDialog.getOpenFileName)
Output:
Help on built-in function getOpenFileName:
getOpenFileName(...)
getOpenFileName(parent: QWidget = None, caption: str = '', directory: str = '', filter: str = '', initialFilter: str = '', options: Union[QFileDialog.Options, QFileDialog.Option] = 0) -> Tuple[str, str]
Where it shows that it returns a tuple of 2 strings that are the filename of the selected file and the selected filter.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…