ContentItem in custom item
-
Hello all! I wonder what's correct way to implement contentItem property approach in my custom items.
For example, I want to implement Button with the menu, so I have created ButtonMenu.qml with the following code:
Button { id: root property alias menu: _menu onClicked: { _menu.open() } Menu { id: _menu x: 0 y: root.height } }But I can not realize what is the correct and easy way without big and complex loops to add MenuItems in Menu or replace the whole Menu in the outer code while using my ButtonMenu.qml
-
Well, answer is coming after a question even one has googled before it a lot. In the case of using menu,
contentDataproperty can be used for the replacingMenuItem's. I think the same approach can be extended on custom types.