I have a QTreeView
model, that model has four columns as the following (Name
, Size
, Type
, Data Modified
).
I want is to remove the (Size
, Type
, Data Modified
) columns, and leave only the column named Name
.
QFileSystemModel *sysModel = new QFileSystemModel;
sysModel->setRootPath("");
sysModel->setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
ui->treeView->setModel(sysModel);
I want to know, What function is responsible for that?
QTreeView::setColumnHidden(int column, bool hide)
does the trick.
You can also use QTreeView::hideColumn(int column)
.