Damn, you are very resistant to advices! USE THE FUCKING CODE TAGS! The last time I'll help you when you are not going to use them:
QTableWidget::clearContents(), and then reset the dimension.