PDA

View Full Version : header for tableView of QStandardItemModel



Omid123
9th February 2015, 22:21
Hi there,

I use QStandardItemModel and want to add header text to my tableView. I thought I have to use "setHorizontalHeaderLabels", however "ui->tableView" doesn't give such a method.

the data for tableView are a child of my model (let say tableView shows children of "model->item(0,0)").

is it right to use:
model->setHeaderData(0, Qt::Horizontal, tr("Name"));


anyone can help?

Thanks,
Omid

d_stranz
10th February 2015, 01:15
See QStandardItemModel::setHorizontalHeaderItem().