Qt Code:
  1. void Victims::load()
  2. {
  3. int grows = ui->tw->rowCount();
  4. int gcols = ui->tw->columnCount();
  5.  
  6. QSettings set("victims");
  7. set.beginGroup("setting");
  8.  
  9. for(int i = 0; i < grows ;i++)
  10. {
  11.  
  12. for(int j = 0; j < gcols ;j++)
  13. {
  14. QTableWidgetItem* widgetItem = ui->tw->item(grows, gcols);
  15. QString ex = set.value("victims", str).toString();
  16. widgetItem->setText(ex);
  17. }
  18.  
  19. }
  20.  
  21. set.endGroup();
  22. }
  23.  
  24.  
  25. void Victims::save()
  26. {
  27. int grows = ui->tw->rowCount();
  28. int gcols = ui->tw->columnCount();
  29.  
  30. QSettings set("victims");
  31. set.beginGroup("setting");
  32.  
  33. for(int i = 0; i < grows ;i++)
  34. {
  35.  
  36. for(int j = 0; j < gcols ;j++)
  37. {
  38. QTableWidgetItem* widgetItem = ui->tw->item(grows, gcols);
  39. str = widgetItem->text();
  40. }
  41.  
  42. }
  43. set.setValue("victims", str);
  44. set.endGroup();
  45. }
To copy to clipboard, switch view to plain text mode 

Can you tell me what I did wrong here?