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

[Solved] QMdiSubWindow deletes internal widget on close?



  • Hello everyone,

    I have some questions:

    Does QMdiSubWindow deletes the internal widget on close?

    Does it delete the widget when ~QMdiSubWindow() is called?

    Does the widget get destroyed before program exit, or can I expect memory leakage?

    On documentation internal widget destruction time isn't very clear, and neither when ~QMdiSubWindow() is called.

    Thanks in advance!
    Cheers,
    Seba84



  • On close, it hides itself, unless you tell it to delete on close via the Qt::WA_DeleteOnClose attribute, same as any other window.

    Again like any other widget, it will cause its children to be deleted when it is deleted.

    It does (usually), but even if it didn't, the OS will reclaim the memory, so it's not like you will have a memory leak once the program is shut down.



  • Thanks Chris!


Log in to reply