mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 10:50:00 +00:00

* Extend the cspell word list * Remove those extensions from individual source files * white-list licenses and such as we should not meddle with those * Fix spelling
34 lines
904 B
Text
34 lines
904 B
Text
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
|
// 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;
|
|
}
|
|
}
|
|
}
|