[solved]Qt Quick Controls Scope
-
Hello,
i have problems with the following code:
@
Rectangle {
width: 360
height: 360MenuManager { id: menu } ListView { anchors.fill: parent model: menu.activeMenu delegate: Rectangle { width: 360 height: 360 Button { anchors.fill parent text: "Back" onClicked: { menu.MenuBack() //<- dosen't work } }
// MouseArea {
// anchors.fill: parent
// onClicked: {
// menu.MenuBack() //<- works!
// }
// }
}
}
}
@When i use the MouseArea Element in the delegate i can call a function of the MenuManager Object. When i use a Button it dosen't work. In the Button's onClicked method menu is undefined.
(The MenuManager Object is a c++ class. The methods are marked as Q_INVOKABLE, and the class is registerd via qmlRegisterType)Any ideas what's the reason for this behaviour?
Thanks
-
Button itself has a property named "menu". You use this to set a popup menu on the button. The scope rules will first look in the item itself for a property named menu before your menu name declaration is found. Just rename the menu manager to something else and it should work fine.
-
Thanks,
after the renaming of the property everything works.