How can I remove columns from a QTreeView (using QDirModel)?

点点圈 提交于 2019-12-11 13:10:23

问题


I have a QDirModel attached to a QTreeView and I only want to see the paths, not size, type and date modified.

Is there a way to remove these columns?


回答1:


QTreeView::setColumnHidden(int column, bool hide) should do the trick.




回答2:


One can also use hideColumn(). Something like:

for i in range(1, self.my_tree_view.header().length()):
    self.my_tree_view.hideColumn(i)


来源:https://stackoverflow.com/questions/4203022/how-can-i-remove-columns-from-a-qtreeview-using-qdirmodel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!