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

How to cancel the QML menu once it is clicked ?



  • I have tried many QT5.5 QML examples which have menu, they
    all have the same problem: can not cancel the menu once
    it was clicked, unless you click a menuitem.

    One of the examples is listed as
    http://doc.qt.io/qt-5/qtquickcontrols-texteditor-example.html

    Moreover, once you clicked the menu, and you move the main
    application window, the pending menu will stay wherever it
    was anchored on the screen(not moved with the main window).

    I have also tried using MouseArea under menu, but did not
    work:

    Menu {
    id: id_FileMenu
    title: qsTr("File")
    ...
    MouseArea {
    anchors.fill: parent
    hoverEnabled: true
    onExited: {
    console.log("Exited Menu.");
    parent.exit();
    }
    }
    }


Log in to reply