Hi Yall,
I'm using a QTableView with a QStringListModel and can't seem to set the label text for the column in the table view. Heres the code:
my_list << "one" << "two" << "three";
pModel->setHeaderData(0, Qt::Horizontal, lbl);
ui.inittabTable->setModel(pModel);
QString lbl = "Some Text";
QStringList my_list;
my_list << "one" << "two" << "three";
QStringListModel *pModel = new QStringListModel(my_list);
pModel->setHeaderData(0, Qt::Horizontal, lbl);
ui.inittabTable->setModel(pModel);
To copy to clipboard, switch view to plain text mode
Where am I going wrong? No matter how I try, the header is always a "1".
Bookmarks