I am still not sure on how to solve this issue.
Hopefully the following code will help to locate the missing calls in order to resize the main window. Here is how I add the new widgets at runtime:
Qt Code:
  1. lbltest = new QLabel(ui->tabw);
  2. lbltest->setObjectName(QString::fromUtf8("lbltest"));
  3.  
  4. lbltest->setAlignment(Qt::AlignCenter);
  5. lbltest->setText("This is a test");
  6.  
  7. ui->gl1->addWidget(lbltest,4,0,1,1);
  8.  
  9. lbltest2 = new QLabel(ui->tabw);
  10. lbltest2->setObjectName(QString::fromUtf8("lbltest2"));
  11.  
  12. lbltest2->setAlignment(Qt::AlignCenter);
  13. lbltest2->setText("test");
  14.  
  15. ui->gl1->addWidget(lbltest2,5,0,1,1);
To copy to clipboard, switch view to plain text mode 

This will work as expected and the mainwindow grows to accomodate the extra widgets.

Now I try to remove the labels with the following code:

Qt Code:
  1. if (lbltest != NULL)
  2. {
  3. ui->gl1->removeWidget(lbltest);
  4. delete lbltest;
  5. lbltest = NULL;
  6. }
  7. if (lbltest2 != NULL)
  8. {
  9. ui->gl1->removeWidget(lbltest2);
  10. delete lbltest2;
  11. lbltest2 = NULL;
  12. }
To copy to clipboard, switch view to plain text mode 

I was hoping the mainwindow would shrink back to its original size, but instead, the original widgets expand into the additional space. At this point I can manually resize by dragging the border of the mainwindow back to the original size. Is it possible to achieve this programmatically?