mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-03 01:33:19 +00:00
Switch from Qt6 to Slint
This commit is contained in:
parent
f8be14bcf8
commit
63bf267a22
107 changed files with 27532 additions and 2896 deletions
35
lib/slint-vynui/ToggleButton.slint
Normal file
35
lib/slint-vynui/ToggleButton.slint
Normal file
|
@ -0,0 +1,35 @@
|
|||
import { Palette } from "Palette.slint";
|
||||
import { VText } from "Text.slint";
|
||||
|
||||
export component ToggleButton inherits Rectangle {
|
||||
|
||||
in property text <=> text-component.text;
|
||||
in property text-color <=> text-component.color;
|
||||
in property text-alignment <=> text-component.horizontal-alignment;
|
||||
callback clicked;
|
||||
|
||||
private property<bool> active: false;
|
||||
|
||||
background: root.active ? Palette.control-background
|
||||
: ta.has-hover ? Palette.control-background.transparentize(0.5)
|
||||
: Colors.transparent;
|
||||
border-radius: 4px;
|
||||
|
||||
ta := TouchArea {
|
||||
mouse-cursor: pointer;
|
||||
clicked => {
|
||||
active = !active;
|
||||
root.clicked();
|
||||
}
|
||||
}
|
||||
|
||||
VerticalLayout {
|
||||
padding: 8px;
|
||||
padding-top: 4px;
|
||||
padding-bottom: 4px;
|
||||
text-component := VText {
|
||||
horizontal-alignment: center;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue