mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-03 15:14:35 +00:00
105 lines
2 KiB
Text
105 lines
2 KiB
Text
|
|
component TwoRectangle := Rectangle {
|
|
|
|
signal clicked;
|
|
|
|
Rectangle {
|
|
x: 50;
|
|
y: 50.;
|
|
width: 25;
|
|
height: 25;
|
|
color: red;
|
|
|
|
my_area := TouchArea {
|
|
width: 25;
|
|
height: 25;
|
|
clicked => { root.clicked() }
|
|
}
|
|
}
|
|
}
|
|
|
|
component ButtonRectangle := Rectangle {
|
|
property<string> button_text;
|
|
property<color> button_color;
|
|
signal clicked;
|
|
width: 100;
|
|
height: 75;
|
|
color: button_area.pressed ? red : button_color;
|
|
button_area := TouchArea {
|
|
width: root.width;
|
|
height: root.height;
|
|
clicked => { root.clicked() }
|
|
}
|
|
Text {
|
|
x: 50;
|
|
y: 10;
|
|
text: button_text;
|
|
color: black;
|
|
}
|
|
}
|
|
|
|
Hello := Rectangle {
|
|
|
|
signal foobar;
|
|
signal plus_clicked;
|
|
signal minus_clicked;
|
|
|
|
color: white;
|
|
|
|
TwoRectangle {
|
|
width: 100;
|
|
height: 100;
|
|
color: blue;
|
|
clicked => { foobar() }
|
|
}
|
|
Rectangle {
|
|
x: 100;
|
|
y: 100;
|
|
width: (100);
|
|
height: {100}
|
|
color: green;
|
|
Rectangle {
|
|
x: 50;
|
|
y: 50.;
|
|
width: 25;
|
|
height: 25;
|
|
color: yellow;
|
|
}
|
|
}
|
|
Image {
|
|
x: 200;
|
|
y: 200;
|
|
source: img!"../graphicstest/logo.png";
|
|
}
|
|
|
|
property<int32> counter;
|
|
|
|
Rectangle {
|
|
x: 50;
|
|
y: 225;
|
|
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: "-";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|