I have this test case:

Qt Code:
  1. // Scroll
  2. QScrollArea *sa = new QScrollArea(ui->centralWidget);
  3. sa->setWidgetResizable( true );
  4.  
  5. // Layout for widgets
  6. QVBoxLayout *vl_2 = new QVBoxLayout();
  7. vl_2->setSpacing(0);
  8.  
  9. // Widget to attach the scroll to and the layout
  10. QWidget *widget = new QWidget()
  11. widget->setLayout(vl_2);
  12. sa->setWidget(widget);
  13.  
  14. // Test widgets
  15. QComboBox *cb_1 = new QComboBox();
  16. QComboBox *cb_2 = new QComboBox();
  17. vl_2->addWidget( cb_1 );
  18. vl_2->addWidget( cb_2 );
To copy to clipboard, switch view to plain text mode 

And the widgets have 0 space between them.

But if I add them to a QTabWdiget, it all breaks as if QTabWidget does not respect the set setSpacing(0);

Qt Code:
  1. // TabWidget
  2. QTabWidget *run_results = new QTabWidget(ui->centralWidget);
  3. run_results->resize( this->size().width() -20, this->size().height() -80 );
  4. run_results->show();
  5.  
  6. // Scroll
  7. QScrollArea *sa = new QScrollArea(ui->centralWidget);
  8. sa->setWidgetResizable( true );
  9.  
  10. // Layout for widgets
  11. QVBoxLayout *vl_2 = new QVBoxLayout();
  12. vl_2->setSpacing(0);
  13.  
  14. // Widget to attach the scroll to and the layout
  15. QWidget *widget = new QWidget()
  16. widget->setLayout(vl_2);
  17. sa->setWidget(widget);
  18.  
  19. // Add the scroll to as the TabWidget tab.
  20. run_results->addTab(sa, "test");
  21.  
  22. // Test widgets
  23. QComboBox *cb_1 = new QComboBox();
  24. QComboBox *cb_2 = new QComboBox();
  25. vl_2->addWidget( cb_1 );
  26. vl_2->addWidget( cb_2 );
To copy to clipboard, switch view to plain text mode 

Anyone know what I need to do to force QTabWidget to not resize and move my widgets so that they take all the space?

I tried to add Qt::AlignTop to the addWdiget but it did nothing other than place the first widget at the top and the next in the middle of the screen.