sj755
sj755

Reputation: 4062

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?

Upvotes: 3

Views: 510

Answers (1)

Johan Råde
Johan Råde

Reputation: 21357

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

Upvotes: 4

Related Questions