2
我在Column
中有一组按钮,我已设置autoExclusive : true
。现在只能按预期检查一个按钮。但是,如果我点击已经检查过的按钮,如何禁用已选状态?以下是代码:设置QML中按钮的选中属性
Column {
id: column
Button {
checked: true
text: qsTr("button 1")
autoExclusive : true
checkable : true
background: Rectangle {
color:checked ? "red" : "white"
}
}
Button {
checked: true
text: qsTr("button 2")
autoExclusive : true
checkable : true
background: Rectangle {
color:checked ? "red" : "white"
}
}
Button {
checked: true
text: qsTr("button 3")
autoExclusive : true
checkable : true
background: Rectangle {
color:checked ? "red" : "white"
}
}
}
我不认为它会工作。每次设置检查属性为false将无法正常工作!!! – pra7
是的,我知道,但我告诉你如何禁用检查状态:)) –
我更新的代码,你可以尝试它是否工作。 –