mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-02 14:51:15 +00:00
md: adjust GroupBox, CheckBox and SpinBox (#1812)
Now it's also possible to toggle checked by click on the text of the CheckBox similar to fluent design GroupBox now respect the minimum width of the title, to avoid elision Adopt SpinBox: set focus when buttons are clicked #1795 on md SpinBox
This commit is contained in:
parent
217fa9a337
commit
7a01e3c0cb
3 changed files with 28 additions and 24 deletions
|
@ -19,7 +19,7 @@ export CheckBox := Rectangle {
|
|||
accessible-checked <=> checked;
|
||||
accessible-role: checkbox;
|
||||
|
||||
HorizontalLayout {
|
||||
layout := HorizontalLayout {
|
||||
spacing: 16px;
|
||||
|
||||
Rectangle {
|
||||
|
@ -62,16 +62,6 @@ export CheckBox := Rectangle {
|
|||
}
|
||||
]
|
||||
}
|
||||
|
||||
touch := TouchArea {
|
||||
enabled <=> root.enabled;
|
||||
clicked => {
|
||||
if (root.enabled) {
|
||||
root.checked = !root.checked;
|
||||
root.toggled();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
label := Text {
|
||||
|
@ -84,6 +74,19 @@ export CheckBox := Rectangle {
|
|||
}
|
||||
}
|
||||
|
||||
touch := TouchArea {
|
||||
x: layout.padding-left;
|
||||
width: layout.width - layout.padding-left - layout.padding-right;
|
||||
height: 100%;
|
||||
enabled <=> root.enabled;
|
||||
clicked => {
|
||||
if (root.enabled) {
|
||||
root.checked = !root.checked;
|
||||
root.toggled();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fs := FocusScope {
|
||||
width: 0px; // Do not react on clicks
|
||||
enabled <=> root.enabled;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue