Close a Qframe when it open new one
-
my application have a mainwindow with a full screen mdiarea and a menù bar.
When cliked on menù item it open a qframe/qwidget. Every menù item open a new different qframe. My qframe have different classes but are all parent of qframe.
How I can close a qframe when I open a new one with menù item?
this code, in my mainwindows work only when the old qframe is open one time:
@ void main2::newframe()
{if (m_newprogram != NULL) //work only if m_newprogram is already used { m_newprogram->close();} m_newframe = new Frame(ui->mdiArea); m_newframe->show(); m_newframe->activateWindow(); m_newframe->setAttribute(Qt::WA_DeleteOnClose); }@
any suggestions?