[SOLVED]Doesn't QTableWidgetItems create memory leaks
We usually add items to QTableWidget in this manner
@QTableWidgetItem *item0 = new QTableWidgetItem();
QTableWidgetItem *item1 = new QTableWidgetItem();
ui->tableWidget->setItem(m, 0, item0);
ui->tableWidget->setItem(m, 1, item1);
Now, if suppose we clear the table
And again execute the code for displaying entry, new items will be created for displaying. Creating memory leaks, as there we did not delete the item1 and item2
If you actually look at the implementation file of "qtablewidget.cpp":http://qt.gitorious.org/qt/qt/blobs/4.7/src/gui/itemviews/qtablewidget.cpp
it actually deletes the items.
Thanks a lot! I was really concerned over this issue
You are welcome.