Skip to content
Advertisement

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 or in view.

Advertisement

Answer

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

Advertisement