Open QiangZiBro opened 4 years ago
Hi, bro, nice work! I find that
QFileSystemModel.setRootPath
seems not to work in PyQt5, so I modified some codes according to this and it works now origin codeself.fileSystemModel = QFileSystemModel() self.fileSystemModel.setRootPath('.') self.setModel(self.fileSystemModel)
modified
# 设置根目录 self.fileSystemModel = QFileSystemModel() # 1 self.setModel(self.fileSystemModel) # 2 self.fileSystemModel.setRootPath(QDir.rootPath()) # 3 self.setRootIndex(self.fileSystemModel.index("/Users/mac/Pictures")) # 4
感谢指正!摸索学习中
Hi, bro, nice work! I find that
QFileSystemModel.setRootPath
seems not to work in PyQt5, so I modified some codes according to this and it works now origin codemodified