HI...I have a problem with the dynamically add of tabs to a tabwidget.
I create a GUI with a TabWidget...now, by code, when I add a tab wich has inside a widget created by mine Alarm1 (it has some qlabel and qbuttons inside), the tab was created and added but It don't display anything about the widget Alarm1. Strange because the same code in the constructor works fine like I want. Why?
This is part of the code:

Qt Code:
  1. //Add Alarm to Alarms List
  2. tab = new QWidget( twAlarms, "tab" );
  3. tabLayout = new QVBoxLayout( tab, 11, 6, "tabLayout");
  4. Alarm1 * alm = new Alarm1(alarm,tab);
  5. tabLayout->addWidget(alm);
  6. twAlarms->insertTab( tab, QString::fromLatin1("Alarm 1") );
  7. connect(alm, SIGNAL(buttonClicked()), this, SLOT(alarmSent()));
To copy to clipboard, switch view to plain text mode 

In the constructor instead the code is:

Qt Code:
  1. twAlarms->removePage(tab);
  2. tab->close();
  3.  
  4. for (int i=0; i<3; i++) {
  5. tab = new QWidget( twAlarms, "tab" );
  6. tabLayout = new QVBoxLayout( tab, 11, 6, "tabLayout");
  7. Alarm1 * alm = new Alarm1(alarm, tab);
  8. tabLayout->addWidget(alm);
  9. twAlarms->insertTab( tab, QString::fromLatin1("Alarm"+QString::number(i)) );
  10. connect(alm, SIGNAL(buttonClicked()), this, SLOT(alarmSent()));
  11. }
To copy to clipboard, switch view to plain text mode