CheckBox
import { CheckBox } from "std-widgets.slint";export component Example inherits Window { width: 200px; height: 25px; background: transparent; CheckBox { x: 5px; width: parent.width; height: parent.height; text: "Hello World"; }}slint
使用 CheckBox 让用户选择或取消选择值,例如在具有多个选项的列表中。如果该操作更像是打开或关闭某物,请考虑改用 Switch 元素。
checked
Section titled “checked”bool(in-out)default: false
复选框是否已选中。
CheckBox { text: self.checked ? "Checked" : "Not checked"; checked: true;}slint
enabled
Section titled “enabled”booldefault: true
默认为 true。当为 false 时,复选框无法被按下。
font-size
Section titled “font-size”lengthdefault: 0px
标签文本的字体大小。
font-weight
Section titled “font-weight”intdefault: 0
标签文本的字体粗细。
has-focus
Section titled “has-focus”bool(out)
当复选框具有键盘焦点时设置为 true。
toggled()
Section titled “toggled()”复选框的值发生了变化
CheckBox { text: "CheckBox"; toggled() => { debug("CheckBox checked: ", self.checked); }}slint
© 2026 SixtyFPS GmbH