开发者

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

开发者 https://www.devze.com 2023-01-25 06:30 出处:网络
I have a QDirModel attached to a QTreeView and I only want to see the paths, not size, type and date modified.

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开发者_运维知识库?


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


One can also use hideColumn(). Something like:

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

精彩评论

暂无评论...
验证码 换一张
取 消