I am trying to set up cascading tabs using QTabWidget.

A tab widget appears inside of another tabwidget, which is itself inside of another tab widget

the innermost tab widget has a variable number of tabs. It is being sized way too small, and if I put more than 4 tabs on it, scroll buttons appear on it no matter what I do, including using setUsesScrollButtons(false).

here is the code

Qt Code:
  1. BusAlarms::BusAlarms(int busNumber)
  2. {
  3. locationLabel = new QLabel("location: " + (QString)hotel.getLaneconBusLocation(busNumber));
  4. busNumberLabel = new QLabel("bus number: " + QString::number(busNumber));
  5.  
  6. laneconTabs = new QTabWidget;
  7.  
  8.  
  9. for(int laneconN = 0; laneconN < hotel.getNOfLanecons(busNumber); laneconN++){
  10.  
  11. laneconAlarms[laneconN] = new LaneconAlarms(laneconN,busNumber);
  12.  
  13. laneconTabs->addTab(laneconAlarms[laneconN],QString::number(hotel.getLaneconID( busNumber, laneconN),16));
  14. }
  15.  
  16. QGridLayout *vLayout = new QGridLayout;
  17. vLayout->addWidget(busNumberLabel,0,0);
  18. vLayout->addWidget(locationLabel,1,0);
  19. vLayout->addWidget(laneconTabs,2,0);
  20.  
  21. laneconTabs->setUsesScrollButtons(false);
  22.  
  23. setLayout(vLayout);
  24. }
To copy to clipboard, switch view to plain text mode 

here is where LaneconAlarms is built:

Qt Code:
  1. LaneconAlarms::LaneconAlarms(int laneconNumber, int busNumber)
  2. {
  3. QGridLayout *vLayout = new QGridLayout;
  4. idLabel = new QLabel("ID: " + QString::number(hotel.getLaneconID( busNumber, laneconNumber),16));
  5. vLayout->addWidget(idLabel,0,0);
  6. for(int switchN = 0; switchN < hotel.getNOfLaneconSwitches(busNumber, laneconNumber); switchN++){
  7. switchLabels[switchN] = new QLabel(QString::number(switchN));
  8. vLayout->addWidget(switchLabels[switchN],1+switchN,0);
  9. }
  10. voltageLabel = new QLabel("voltage: ");
  11. currentLabel = new QLabel("current: ");
  12. gfLabel = new QLabel("gf: ");
  13. voltageAlarmAcknowledge = new QCheckBox("acknowledge");
  14. currentAlarmAcknowledge = new QCheckBox("acknowledge");
  15. gfAlarmAcknowledge = new QCheckBox("acknowledge");
  16.  
  17. vLayout->addWidget(voltageLabel,2+MAX_NUMBER_OF_SWITCHES_PER_LANECON,0);
  18. vLayout->addWidget(currentLabel,3+MAX_NUMBER_OF_SWITCHES_PER_LANECON,0);
  19. vLayout->addWidget(gfLabel,4+MAX_NUMBER_OF_SWITCHES_PER_LANECON,0);
  20.  
  21. vLayout->addWidget(voltageAlarmAcknowledge,2+MAX_NUMBER_OF_SWITCHES_PER_LANECON,1);
  22. vLayout->addWidget(currentAlarmAcknowledge,3+MAX_NUMBER_OF_SWITCHES_PER_LANECON,1);
  23. vLayout->addWidget(gfAlarmAcknowledge,4+MAX_NUMBER_OF_SWITCHES_PER_LANECON,1);
  24. setLayout(vLayout);
  25.  
  26. }
To copy to clipboard, switch view to plain text mode 

each LaneconAlarm is fairly small in screen space, and each tab is drawn only to its required size. So instead of a tab widget that fills the available space--or even makes it expand-- I have a small set of tabs with scroll bars, and lots of available space around it. What I would like is for the widgets to expand into that available space.

I have tried very hard to attach an image that shows the result of my code, but the attachment technique doesn't appear to work--when I either select my image or drag it into the attachment window, I end up with a window showing my image, but no other options for attach, post inline, etc.

any ideas?