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 :

Qt Code:
  1. // Called this in constructor
  2. model = new QStandardItemModel(0,0,this);
  3.  
  4. // this is the logic of showing the view for Table View
  5. tableView = new QTableView(this);
  6. tableView->setModel(model);
  7. tableView->verticalHeader()->setVisible(false);
  8. tableView->verticalHeader()->setDefaultSectionSize(10);
  9.  
  10. for(int i = 0; i < clusterNames.length(); i++) {
  11. QStandardItem *clusterName_i = new QStandardItem(clusterNames[i]);
  12. QStandardItem *clusterIP_i = new QStandardItem(clusterIPs[i]);
  13.  
  14. model->setItem(i, 0, clusterName_i);
  15. model->setItem(i, 1, clusterIP_i);
  16. }
  17.  
  18. 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