Put the code I have posted above into the header (once for each column). No need to do it again and again ...

But may be this is what you are really looking for:

Qt Code:
  1. tableWidget->verticalHeader()->setDefaultSectionSize(50);
  2. tableWidget->horizontalHeader()->setDefaultSectionSize(200);
To copy to clipboard, switch view to plain text mode