我的QML桌面应用程序中有三个RadioButtons,当我点击一个时 - 我想要取消选中所有其他的,但是一旦我将它们设置为未选中状态,它们就会变得不受控制,但我看不到它,直到我将鼠标移到它们上面。我尝试了很多方法来解决它,并没有找到任何好的方法。你有没有办法模拟鼠标悬停在事件上,然后它们会显示为未选中状态?帮帮我plizzzzzzzzzzzzz !!!我写了这段代码:
property int openSessionCurrentIndex: -1
onOpenSessionCurrentIndexChanged: {
rbtnHexadecimal1.checked = openSessionCurrentIndex == 0
rbtnDecimal1.checked = openSessionCurrentIndex == 1
rbtnString1.checked = openSessionCurrentIndex == 2
}
和
RadioButton{
id:rbtnHexadecimal1
width: 140
onClicked:{
openSessionItem.openSessionCurrentIndex = 0
}
text: "Hexadecimal Data"
anchors.left: parent.left
checked: true
}
RadioButton{
id:rbtnDecimal1
width: 130
onClicked:{
openSessionItem.openSessionCurrentIndex = 1
}
text: "Decimal Data"
anchors.left:rbtnHexadecimal1.right
}
RadioButton{
id:rbtnString1
width: 140
onClicked:{
openSessionItem.openSessionCurrentIndex = 2
}
text: "String Data"
anchors.left:rbtnDecimal1.right
}
缩短,我需要一个解决方案,以便当radioButton取消选中时 - 它显示为这样。任何想法?Tnx领先!