昆明网站制作的教程,只做美食类目产品的网站,保定手机网站,免费空间asp网站比如在Listview的表头设置了一个复选框#xff0c;之后想要在其他控件中动态修改复选框的文本#xff0c;通过id来修改无效#xff0c;因为它在表头内#xff0c;对其他控件来说未定义。可以采用一个外部属性来解决#xff1a;
Window {width: 400height: 400visible: tr…比如在Listview的表头设置了一个复选框之后想要在其他控件中动态修改复选框的文本通过id来修改无效因为它在表头内对其他控件来说未定义。可以采用一个外部属性来解决
Window {width: 400height: 400visible: trueproperty int title: 1property string name: qsTr(1)ListView{id: viewwidth: parent.widthheight: parent.height - 50header: Item{width: parent.widthheight: 30CheckBox{id:checkalltext: name}}}Button{width: 60height: 20anchors.top: view.bottom;text: qsTr(切换)onClicked: {title 1if(title 4)title 1if(title1)name qsTr(1)else if(title2)name qsTr(2)else if(title3)name qsTr(3)else if(title4)name qsTr(4)}}
}