import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.5
Window {
width: 640
height: 480
color: "white"
title: qsTr("My QML")
visible: true
//使得Column排它
ButtonGroup{
id: column
//置为false后失去排它性
exclusive: false
buttons: col.children
}
Column {
id: col
CheckBox {
id:col1
text: qsTr("Breakfast")
//初始为选中状态
checked: true
//三态
tristate: true
//打印状态
onCheckStateChanged: {
console.log(checkState)
}
}
CheckBox {
text: qsTr("Lunch")
//在col1改变时状态和col1同步
// checkState: col1.checkState
}
CheckBox {
text: qsTr("Dinner")
checked: true
}
}
}
QML-CheckBox
最新推荐文章于 2024-06-27 08:45:00 发布