mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-29 13:24:48 +00:00
Layout for rust
This commit is contained in:
parent
96a372e45d
commit
907bea3d3b
7 changed files with 122 additions and 30 deletions
|
@ -26,8 +26,8 @@ component ButtonRectangle := Rectangle {
|
|||
height: 75;
|
||||
color: button_area.pressed ? red : button_color;
|
||||
button_area := TouchArea {
|
||||
width: 100;
|
||||
height: 75;
|
||||
width: root.width;
|
||||
height: root.height;
|
||||
clicked => { root.clicked() }
|
||||
}
|
||||
Text {
|
||||
|
@ -72,22 +72,34 @@ Hello := Rectangle {
|
|||
source: img!"../graphicstest/logo.png";
|
||||
}
|
||||
|
||||
ButtonRectangle {
|
||||
button_color: 4289374890;
|
||||
property<int32> counter;
|
||||
|
||||
Rectangle {
|
||||
x: 50;
|
||||
y: 225;
|
||||
clicked => { counter += 1 }
|
||||
button_text: "+";
|
||||
}
|
||||
property<int32> counter;
|
||||
counter_label := Text { x: 100; y: 300; text: counter; color: black; }
|
||||
ButtonRectangle {
|
||||
button_color: 4289374890;
|
||||
x: 50;
|
||||
y: 350;
|
||||
clicked => { minus_clicked() }
|
||||
button_text: "-";
|
||||
}
|
||||
width: 100;
|
||||
height: 225;
|
||||
|
||||
|
||||
GridLayout {
|
||||
Row {
|
||||
ButtonRectangle {
|
||||
button_color: 4289374890;
|
||||
clicked => { counter += 1 }
|
||||
button_text: "+";
|
||||
}
|
||||
}
|
||||
Row {
|
||||
counter_label := Text { text: counter; color: black; }
|
||||
}
|
||||
Row {
|
||||
ButtonRectangle {
|
||||
button_color: 4289374890;
|
||||
clicked => { minus_clicked() }
|
||||
button_text: "-";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue