ButtonGroup{
id : btnGroup
exclusive: true
}
Column {
id : col
CheckBox {
text: qsTr("First")
ButtonGroup.group: btnGroup
}
CheckBox {
ButtonGroup.group: btnGroup
text: qsTr("Second")
}
CheckBox {
ButtonGroup.group: btnGroup
text: qsTr("Third")
}
}
ButtonGroup{
id : btnGroup
exclusive: true
buttons: col.children
}
Column {
id : col
CheckBox {
checked: true
text: qsTr("First")
}
CheckBox {
text: qsTr("Second")
}
CheckBox {
text: qsTr("Third")
}
}
ButtonGroup{
id : btnGroup
exclusive: true
}
Column {
id : col
CheckBox {
checked: true
text: qsTr("First")
ButtonGroup.group: btnGroup
}
CheckBox {
text: qsTr("Second")
ButtonGroup.group: btnGroup
}
CheckBox {
text: qsTr("Third")
ButtonGroup.group: btnGroup
}
}
Column {
ButtonGroup {
id: childGroup
exclusive: false
checkState: parentBox.checkState
}
CheckBox {
id: parentBox
text: qsTr("Parent")
checkState: childGroup.checkState
}
CheckBox {
checked: true
text: qsTr("Child 1")
leftPadding: indicator.width
ButtonGroup.group: childGroup
}
CheckBox {
text: qsTr("Child 2")
leftPadding: indicator.width
ButtonGroup.group: childGroup
}
}
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/4c9edfa03f17b35c75eeccfb9391b63a.png)