I am writing simple code using pyqt
In the code, I call QFileDialog , but when I call it using static functions, everything works fine, but with the usual method, that is, using dialog.exec_(), I do not see any files in the file dialog box.
Only after entering the full path of the file can I see the file in the file dialog box. Note that this problem only occurs when the FileDialoghandler function is called. If I do not, no matter how I call QFileDialog , everything works fine. And also this problem is only in Linux, on Windows7 everything works fine. I am wondering if this is a PyQt bug or am I missing something here?
The code is as follows:
import sys from PyQt4.QtCore import Qt from PyQt4.QtGui import * from PyQt4.QtCore import QAbstractFileEngine from PyQt4.QtCore import QAbstractFileEngineHandler from PyQt4.QtCore import QFSFileEngine class FileDialogHandler(QAbstractFileEngineHandler): def create(self,filename): if str(filename).startswith(':'): return None
source share