问题
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