View Full Version : About QTableWidget's setRowCount

28th October 2011, 03:47
Hi all I have a question,

Consider I have 10 row in my QTableWidget. I put some texts in each item. Then I use


With above code, did the items automatically deleted or we just lost the pointer to them? can't find about this in documentation

Sorry for my poor english :)

28th October 2011, 05:34
From QTableWidget::setItem():

Sets the item for the given row and column to item.
The table takes ownership of the item.

So the table is responsible for deleting the items it contains. The same is true of widgets added to cells.