Warnings when creating embedded Menus with Instantiator
-
I'd like to create a Menu in QML application that has other Menus depending on some Model. When I use Instantiator for that, items which are being created are parented to the Instantiator itself and when adding them to top-level Menu, it complains about
__parentMenu
being nullMenu { title: qsTr("Top-Level Menu") id: topMenu Instantiator { model: aTopLevelModel onObjectAdded: topMenu.insertItem( index, object ) onObjectRemoved: topMenu.removeItem( object ) delegate: Menu { id: innerMenu title: qsTr("Inner Menu") Instantiator { model: aTopLevelModel.getInnerModel(index) onObjectAdded: innerMenu.insertItem( index, object ) onObjectRemoved: innerMenu.removeItem( object ) delegate: MenuItem { text: qsTr("Menu action!") onTriggered: { console.log("Action of inner menu") } } } } } }
The warning I'm observing is:
Menu.qml:149: TypeError: Cannot read property '__contentItem' of null
Where the line 149 is
property var __parentContentItem: __parentMenu.__contentItem
.How can I overcome this Warning being produced?
Qt version is 5.5.1. This behavior is observed undre OS X and Windows versions of Qt.