Hey Folks !
Hope you all are doing well.
I have been through a lot of similar links regarding the question but yet i didn't found any perfect solution regarding that. Here's my code :
// Called this in constructor
// this is the logic of showing the view for Table View
tableView->setModel(model);
tableView->verticalHeader()->setVisible(false);
tableView->verticalHeader()->setDefaultSectionSize(10);
for(int i = 0; i < clusterNames.length(); i++) {
model->setItem(i, 0, clusterName_i);
model->setItem(i, 1, clusterIP_i);
}
tableView->viewport()->update();
// Called this in constructor
model = new QStandardItemModel(0,0,this);
// this is the logic of showing the view for Table View
tableView = new QTableView(this);
tableView->setModel(model);
tableView->verticalHeader()->setVisible(false);
tableView->verticalHeader()->setDefaultSectionSize(10);
for(int i = 0; i < clusterNames.length(); i++) {
QStandardItem *clusterName_i = new QStandardItem(clusterNames[i]);
QStandardItem *clusterIP_i = new QStandardItem(clusterIPs[i]);
model->setItem(i, 0, clusterName_i);
model->setItem(i, 1, clusterIP_i);
}
tableView->viewport()->update();
To copy to clipboard, switch view to plain text mode
Logic/Explanation : The logic which i am doing behind this functionality as i populate a QDialog on a button and the data which i insert on the opened Dialog which is of different class. After adding the values i close that dialog and noticed that Tree & Table View aren't updating automatically but when i close that window and reopened it i saw it with updated values.
If anyone have suggestions or the solution that would be a great help for me.
Thanks In Advance
Bookmarks