QMdiArea addSubWindow is not showing window when called from slot
I am passing a MdiArea into a QWidget *child:
Code:
mdiArea = new QMdiArea;
setCentralWidget(mdiArea);
QWidget *child
= new parametertab
(tabWidget, mdiArea
);
mdiArea->addSubWindow(child); //this addSubWindow works as expected
Inside the parametertab constructor, I can addsubwindow, but it does not work when I addsubwindow from within a slot. It does add the window to the subWindowList, and does not produce a warning. Any idea why it does not display the window?
Code:
class parametertab
: public QWidget{
...
private slots:
void runsim();
...
}
{
...
mdiArea->addSubWindow(child); //this works as expected
...
}
void parametertab::runsim()
{
mdiArea->addSubWindow(child); //does not show window?
}
Re: QMdiArea addSubWindow is not showing window when called from slot
A little more info. The signal is from a push button:
Code:
connect(buttonRun, SIGNAL(clicked()),
this, SLOT(runsim()));
Re: QMdiArea addSubWindow is not showing window when called from slot
Now working. Had to add activateWindow() and raise() to get it to show.
Code:
void parametertab::runsim()
{
mdiArea->addSubWindow(child);
child->activateWindow();
child->raise();
}