[Moved] does QTableWidget::clear() also delete QTableWidgetItems ?
I have a QTableWidget which I dynamically build and re-biuld.
I call MyClass::reset() on every re-build where I do QTableWidget::clear ().
Does that also clear (ie free memory) for every QTableWidgetItem constructed for table's cells?
Or do I need to delete these explicitly?
Here's a code snippet
QTableWidgetItem *ChannelItem = new QTableWidgetItem(tr("%1").arg(chan+1));
... a lot more of these
tableWidget_channels->clearContents(); // are items deleted too?
QTableWidget takes ownership of these items, so you can rely on the items being deleted properly.