[SOLVED?]how to detect active Qframe in mdi area



  • I need help for detect the active qframe that my app open inside an mdiArea on mainwindow.



  • QMdiArea::activeSubWindow()



  • don't work for me ..... I've created mdiarea with designer in my main window and in my mainwindow.ccp with signal & slot by menù item I open a new frame(class parent of QFrame) when I clik over a menu item.

    with "QMdiArea::activeSubWindow()" I detect only the mdiarea creted with designer, but not the single frame that I open with menù.



  • for more precision:

    in my mainwindow.ccp I have some of these void (ex.):

    void pesa2::newlavoro()
    {

    //when I open these I need to close all other ..... I have too void pesa2::new1 --> m_new1 -- void pesa2::new2 --> m_new2 etc etc....

    m_newlavoro = new lavoro(ui->mdiArea); // for close lavoro??
    m_newlavoro->show();
    m_newlavoro->activateWindow();
    m_newlavoro->setAttribute(Qt::WA_DeleteOnClose);

    }



  • I tray this ... but obtain only an error of segmentation fault tipe SIGSEV

    void pesa2::newlavoro()
    {

    //when I open these I need to close all other ….. I have too void pesa2::new1 —> m_new1 — void pesa2::new2 —> m_new2 etc etc….

    if (m_new1->isVisible()){m_new1->close();}
    if (m_new2->isVisible()){m_new2->close();}

    m_newlavoro = new lavoro(ui->mdiArea);
    m_newlavoro->show();
    m_newlavoro->activateWindow(); m_newlavoro->setAttribute(Qt::WA_DeleteOnClose);

    }



  • Nothing in your example code has added a widget to the MDI area (with QMdiArea::addSubWindow()) so the call to QMdiArea::activeSubWindow() will return a null pointer. The docs describe other circumstances a null will be returned.



  • I think you're right ... in qt there is no method for add"frame" in mdiArea


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.