开发者

PyQt: removing QTreeView columns

I am using QTreeView with QFileSystemModel. It displays columns like Size, Type, Modification Date, which I don't need. How can I remove them from the view? I can't find any removeColumn in model o开发者_开发百科r in view.


Get the QHeaderView of your TreeView by calling header() on it, the headerview knows about the columns and can hide them via hideSection.


I believe, this post is a duplicate of:
How can I remove columns from a QTreeView (using QDirModel)?

The only difference is that here we are using QFileSystemModel instead of QDirModel - which makes no difference since the columns needs to be hidden in the view.

So I believe pointing to the right solution is the best thing to do.

QTreeView::setColumnHidden(int column, bool hide)
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜