0

So I have this code:

QStackedLayout *layout = new QStackedLayout;

QMdiArea *mdi1 = new QMdiArea;
mdi1->addSubWindow(new QMdiSubWindow);

layout->addWidget(mdi1);

QMdiArea *a = (QMdiArea *) layout->currentWidget();
a->addSubWindow(new QMdiSubWindow);

Which for some reason doesn't work. What I want to do is get the widget that is being displayed in layout - as a QMdiArea, then add a sub window to it.

P.S. this is a simplified version on the full app. adding a sub window directly to mdi1 will work but it is NOT what I'm looking for (as there are many QMdiArea's in the QStackedLayout).

1 Answers1

0

So the answer was that I needed to use QStackedWidget instead of QStackedLayout.