Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How can I get the QMdiSubWindow before it closes ?



  • I've got some QMdiArea in my QMainWindow. I can handle a creation of subwindows and it's activation. But i need to get pointer to subwindow before it close and destroyed. I find out some tabCloseReqested signal in tabbar when i can get index of closed tab. But how can I get pointer to QMdiSubwindow by this index ?



  • May be QObject::destroyed(Qobject*) signal can be helpfull for you?
    Also you can reimplement closeEvent of your QMdiSubWindow and emit signal from it.





  • bq. May be QObject::destroyed(Qobject*) signal can be helpfull for you?
    Also you can reimplement closeEvent of your QMdiSubWindow and emit signal from it.

    I can reimplement close Event, but I need to write my own QMdiSubWindow based class to do that. And I hope to do this with standard QMdiArea or QTabWidget methods.

    bq. Maybe:
    http://doc.qt.digia.com/qt/qmdiarea.html#subWindowList

    subWindowList can't help me. Because when I call it in slot, which connected to tabCloseReqested signal my widget is already destroyed. So there is no item with such index in sub window list at that moment.


Log in to reply