Nominate our 2022 Qt Champions!

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); 

    any suggestions?

Log in to reply