1 | #![allow (deprecated)]slint::slint!{#[include_path=r#"/input/slint/tests/driver/driverlib/../../cases/7guis"# ] |
2 | // Copyright © SixtyFPS GmbH <info@slint.dev> |
3 | // SPDX-License-Identifier: MIT |
4 | |
5 | import { LineEdit, HorizontalBox } from "std-widgets.slint" ; |
6 | |
7 | component TempConv inherits Window { |
8 | preferred-height: 64px; |
9 | layout := HorizontalBox { |
10 | c := LineEdit { |
11 | text: "0" ; |
12 | edited(text) => { |
13 | if (self.text.is-float()) { |
14 | f.text = (self.text.to-float() * 9 / 5) + 32; |
15 | } |
16 | } |
17 | } |
18 | Text { |
19 | text: "°Celsius = " ; |
20 | vertical-alignment: center; |
21 | } |
22 | f := LineEdit { |
23 | text: "32" ; |
24 | edited(text) => { |
25 | if (self.text.is-float()) { |
26 | c.text = (self.text.to-float() - 32) * (5 / 9); |
27 | } |
28 | } |
29 | } |
30 | Text { |
31 | text: "°Fahrenheit" ; |
32 | vertical-alignment: center; |
33 | } |
34 | } |
35 | } |
36 | } |
37 | |