Important: Please read the Qt Code of Conduct -

Destroying dynamically created Dialogs

  • Hello.
    Right now I can't find anything equivalent to Qt::WA_DeleteOnClose from the Widget world for Qt Quick based Windows and Dialog.
    I have this Dialog:

    import QtQuick 2.5
    import QtQuick.Dialogs 1.2
    import QtQuick.Controls 1.4
    Dialog {
        id: dialog
        contentItem: Button {
            anchors.fill: parent
            text: "OK"
            onClicked: {

    And I'm creating it dynamically with:

    var component = Qt.createComponent("MyDialog.qml")
    var obj = component.createObject()

    Besides calls to the destroy() method when the user clicks the Ok button what about the user clicking the top right X button? Will the memory be released?

    Thank you