Hi,
For each QStackedWidget page you need, create a dialog instead that contains the tabwidget with approximately 5 tabs.
Create your main dialog or mainwindow, and put a QStackedWidget on it.
Instantiate each of you dialogs, and add them to the QStackedWidget.
This way you can easily create your different screens visually in Designer without creating a class with a giant number of widgets in it.
Code snippets from a project of mine :
frmRealParts = new CRealPartsForm(this); // add form with Real parts
ui->twComponents->addTab( frmRealParts, "Realparts" );
frmDistParts = new CDistPartsForm(this); // add form with Distributer parts
ui->twComponents->addTab( frmDistParts, "Distributer" );
frmRealParts = new CRealPartsForm(this); // add form with Real parts
ui->twComponents->addTab( frmRealParts, "Realparts" );
frmDistParts = new CDistPartsForm(this); // add form with Distributer parts
ui->twComponents->addTab( frmDistParts, "Distributer" );
To copy to clipboard, switch view to plain text mode
I use a tabwidget (ui->twComponents) to put other dialogs in (CRealPartsForm and CDistPartsForm, which are just dialogs). QStackedWidget has a similar method addWidget() afaik. This code is put in the constructor of my main form, after the ui->setupUI(this);
Best regards,
Marc
Bookmarks