Error adding a Menu in QML
问题 I have the following code: import QtQuick 2.4 import QtQuick.Window 2.2 import QtQuick.Dialogs 1.2 import QtQuick.Controls 1.4 ApplicationWindow { title: qsTr("Hello World!") width: 640 height: 480 visible: true menuBar: MenuBar { id: menuBar } MouseArea { anchors.fill: parent onClicked: { menuBar.menus.addItem("test") } } } When I run it and click, the following message appears: qrc:/main.qml:19: TypeError: Property 'addItem' of object [object Object] is not a function Why is this? EDIT: