我正在使用 Qt Quick Controls 2 并为上下文菜单编写以下代码:
Menu{
id: contextmenu
x: ( parent.width - contextmenu.width ) / 2
y: ( parent.height - contextmenu.height ) / 2
modal: true
property int selid
MenuItem {
text: "Compare"
visible: isexp
}
Divider{ visible: isexp }
MenuItem {
text: "Send..."
visible: isexp
}
Divider{ visible: isexp }
MenuItem {
text: "Edit..."
}
Divider{}
MenuItem {
text: "Delete"
}
}
分频器 - 这是我的组件。isexp是对象的属性。当isexp false 菜单显示错误时。见截图: https ://s31.postimg.org/c608kdtbv/qqq.png
如何更改菜单项的可见性并正确显示菜单。感谢您的建议。