Adding widget to the table passes ownership of that widget to the table view.
The view will manage life time of that widget from now on.
Calling QTableWidget::removeCellWidget( row, column ) is equal to calling QTableWidget::setCellWidget( row, column, NULL ).
Setting new widget on the cell causes old widget to be deleted.
To summarise - QTableWidget::removeCellWidget() deletes the widget.
As far as I'm aware there's no way of reclaiming ownership of a widget from the table.
Besides, I'm not sure what you're trying to achieve (I coulnd't be bothered to read the code carefuly as it's difficult without [CODE] tags).
If all you need is that cell changes background color or is disabled then use QTableWidgetItem::setBackground() and Qt::ItemFlags.




Reply With Quote

Bookmarks