Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Memory Management of QTableWidget Items

If I add a new QTableWidgetItem to a QTableWidget, do I have to free the memory myself or is it automatically handled. For example:

ui->table->setVerticalHeaderItem(0,new QTableWidgetItem(tr("Table Item")));

How is the dynamically created QTableWidgetItem handled?

like image 851
sj755 Avatar asked Dec 05 '25 15:12

sj755


1 Answers

The QTableWidget takes ownership of the QTableWidgetItem. You do not need to delete it.

like image 188
Johan Råde Avatar answered Dec 08 '25 06:12

Johan Råde



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!