Skip to content

ComboBox

import { ComboBox } from "std-widgets.slint";
export component Example inherits Window {
width: 100px;
height: 100px;
background: transparent;
ComboBox {
x: 5px; y: 5px;
width: 100px;
model: ["first", "second", "third"];
current-value: "first";
}
}
slint

一个按钮,点击后会打开弹出窗口以选择值。

int(in-out)default: 0

所选值的索引。

ComboBox {
model: ["first", "second", "third"];
current-index: 1;
}
slint

string(in-out)default: ""

当前选中的文本。

booldefault: true

默认为 true。当为 false 时,无法与组合框交互

bool(out)

当组合框具有键盘焦点时设置为 true。

[string]default: []

可能值的列表

ComboBox {
model: ["first", "second", "third"];
}
slint

用户从组合框中选择了值。参数为当前选中的值。

ComboBox {
model: ["first", "second", "third"];
selected(value) => {
debug("Selected value: ", value);
}
}
slint

© 2026 SixtyFPS GmbH