StonedJesus
StonedJesus

Reputation: 397

Failing to remove attributes of Tree View in Qt

I am a newbie in QT. I am working on a app where I need to display the FileSystem using a treeview.

Basically I have a widget in my .ui file on which I have put a Treeview. Then in my .cpp file I have written the following code:

model = new QFileSystemModel(this);
model->setRootPath(QDir::homePath());
ui->treeView->setModel(model);

In my .h file I have put the following:

QFileSystemModel *model;

When I run the app, it displays the file system inside the treeview but it also shows Name, Type, Size, DateModified above it. I want to get rid of these. Here is the sample Image:

enter image description here

How can I achieve it?

Upvotes: 1

Views: 131

Answers (1)

sashoalm
sashoalm

Reputation: 79685

I think that QTreeView::hideColumn does it.

Upvotes: 2

Related Questions