slint/examples/7guis/tempconv.slint
Florian Blasius 520df46998
Update examples to new syntax (#2067)
* run slint-updater on examples
* manual syntax updates
2023-01-16 12:11:25 +00:00

34 lines
947 B
Text

// Copyright © SixtyFPS GmbH <info@slint-ui.com>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
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: "°Celcius = ";
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;
}
}
}