Here's how i did it:
I used QstandardItemModel and add QStandardItem to it.
then apply the model to my QTableView.
code:
// header
private:
// header
private:
QStandardItemModel *myModel
To copy to clipboard, switch view to plain text mode
// cpp
// in constructor
ui->myTableView->setModel(myModel);
// create the item
// set the item to the model
myModel->setItem(0,0,item1); // 0,0 is row/colum.
// cpp
// in constructor
myModel = new QStandardItemModel(0, 0, this); // an empty model
ui->myTableView->setModel(myModel);
// create the item
QStandardItem *item1 = new QStandardItem("Test");
// set the item to the model
myModel->setItem(0,0,item1); // 0,0 is row/colum.
To copy to clipboard, switch view to plain text mode
Bookmarks