Hi
Main windows is a bit special since it has "central widget".
which there to allow to define areas around it
for Dock windows. That is why we insert widget first.
For all types of other widget we would insert directly.
QWidget* centralWidget = new QWidget();
QVBoxLayout *layout = new QVBoxLayout;
centralWidget->setLayout(layout);
layout->addWidget(st);
setCentralWidget(centralWidget);
seems fine.
For centralWidget , u can then use the Stacked.
My mainWindow code actually looks like:
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
setLayout(layout);
// that sets directly on mainwin. not sure it does what we think.
You can just single step and see the values to find out why u crash.
Sorry, i cant spot it. Running it helps.
I think u need a setCentral also.
That is the reason no 2 to why i like
UI file so much. no crashing as u can only insert legally when visually :)
And no code to try to spot bugs in.
I think u need
new widget
widget as central
new layout
layout to widget
inset stacked to that layout
and then the page stuff