Does QTableWidget::setItem() automatically delete the previous object when it is called for the second time?
Solved
General and Desktop
-
When I read setCellWidget() function, the doc says If cell widget A is replaced with cell widget B, cell widget A will be deleted. and gives out a code snippet example:
setCellWidget(row, column, new QLineEdit); ... //Previously created QLineEdit object will be deleted. setCellWidget(row, column, new QTextEdit);
Now I am wondering does setItem() works like setCellWidget() ? For example:
setItem(row, column, new QTableWidgetItem); ... //Do I need to manually delete the previous QTableWidgetItem object, or free up the memory occupied by the pointer in other words? setItem(row, column, new QTableWidgetItem);