Important: Please read the Qt Code of Conduct -

Has the QTextBrowser windows memory to be deleted?

  • It is a very basic question.

    A QTextBrowser is allocated through new to a pointer. Some text is loaded into the window and shown with show() on screen.

    The text in the browser can be read and maybe closed by using the cross in the right-upper corner on windows.

    For clean-up I thought of connecting a suitable signal of QTextBrowser to be connected to deleteLater of QTextBrowser, but I could not find a suitable signal.

    Did I confuse myself and was trying to overdo the cleanup and it is all already handled within QTextBrowser?

  • Lifetime Qt Champion

    As far as i know, all clean up is handled by its internal q->QTextEdit
    and if the QTextBrowser itself is deleted by parent, no extra clean seems needed.

  • @mrjj

    QTextBrowser has been allocated with nullptr as parent.

    In this case it should still something around?

  • Lifetime Qt Champion


    Use the Qt::WA_DeleteOnClose widget attribute and you should be fine.

Log in to reply