PDA

View Full Version : QTreeView



npc
24th January 2007, 07:34
Hi all,

How to add a column in QTreeView, and how to name that column ?

Thanks,

e8johan
24th January 2007, 07:52
The headers (i.e. columns) are a part of the model.

gri
24th January 2007, 07:53
You need to use a model. Just look up QStandardItemModel in your documentation.


QStandardItemModel* p = new QStandardItemModel(0, 2, myView);
p->setHeaderData(0, Qt::Horizontal, "First Column");
p->setHeaderData(1, Qt::Horizontal, "Second Column");

myView->setModel(p);