Important: Please read the Qt Code of Conduct -

Window and Controls - prevent multiple child windows

  • So I've got the following in a MenuBar:

    MenuItem {
    text: "Connect"
    onTriggered: {
    var component = Qt.createComponent("connect.qml");
    var connectWindow = component.createObject(this);

    Is there a way within QML that I can check to see if connectWindow was already been created in order to prevent the same child window from opening?

  • You could for instance declare connectWindow as a regular property of the main window and only set the visible property to true if it has already been created when you trigger connect.

Log in to reply