【发布时间】:2022-01-24 00:51:04
【问题描述】:
我想在我的 PyQt6 窗口上显示一个文件浏览器,并且成功了,但标题显示了我们可以在普通 Windows 文件资源管理器中看到的所有列(名称、类型、大小等),但我只想要要显示的名称列。
我使用 QFileSystemModel 来显示文件,我真的不知道我应该更改 QFileSystemModel 端的标题还是 QTreeView 的标题。
这是我创建浏览器的代码:
model = QFileSystemModel()
model.setRootPath('C:\\Projects\\Hypertraduction Tool')
tree = QTreeView()
tree.setModel(model)
tree.setRootIndex(model.index('C:\\Projects\\Hypertraduction Tool'))
【问题讨论】:
标签: python pyqt treeview pyqt6