Good day,
I'm trying to edit some QTableWidgetItem values and currently this is what I'm doing
Qt Code:
  1. QTableWidgetItem *temp = new QTableWidgetItem("String 1");
  2. QTableWidgetItem *power = new QTableWidgetItem("String 2");
  3. QTableWidgetItem *dutyCycle = new QTableWidgetItem("String 3");
  4. QString mnemo = "String";
  5.  
  6. for(int i=0;i<29;i++)
  7. {
  8. QTableWidgetItem * head = ui->tLines_tableWidget->verticalHeaderItem(i);
  9. if (head->text()==mnemo)
  10. {
  11. ui->tLines_tableWidget->setItem(i,0,temp);
  12. ui->tLines_tableWidget->setItem(i,2,dutyCycle);
  13. ui->tLines_tableWidget->setItem(i,3,power);
  14. break;
  15. }
  16. }
To copy to clipboard, switch view to plain text mode 

My question is, what happens with the item that i'm replacing? I create the new items with "new" but i never delete them, so do i have a memory leak here?
If i'm losing memory here, how coud i avoid that?

Thanks in advance,
A.G.