Table View not Updating after adding a new Row
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 :
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();
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
Re: Table View not Updating after adding a new Row
The view should update automatically if the model changes.
Maybe check if you are updating a different model than the one you are showing.