Important: Please read the Qt Code of Conduct -

Does .close() activate the destructor of a form class?

  • Hi, when you create a new instance of a form using the @new@ function, does running @this->close()@ activate the destructor of the formclass and thus deleting the form from the heap? Thanks for the help!

  • Hi, welcome to devnet,

    By default no, because how is it suppose to know if it's a heap or stack variable?
    If you want that behavior then you can set a Qt::WA_DeleteOnClose attribute on your widget.

Log in to reply