forked from slint-ui/slint
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtempconv.slint
34 lines (32 loc) · 904 Bytes
/
tempconv.slint
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright © SixtyFPS GmbH <[email protected]>
// SPDX-License-Identifier: MIT
import { LineEdit, HorizontalBox } from "std-widgets.slint";
component TempConv inherits Window {
preferred-height: 64px;
layout := HorizontalBox {
c := LineEdit {
text: "0";
edited(text) => {
if (self.text.is-float()) {
f.text = (self.text.to-float() * 9 / 5) + 32;
}
}
}
Text {
text: "°Celsius = ";
vertical-alignment: center;
}
f := LineEdit {
text: "32";
edited(text) => {
if (self.text.is-float()) {
c.text = (self.text.to-float() - 32) * (5 / 9);
}
}
}
Text {
text: "°Fahrenheit";
vertical-alignment: center;
}
}
}