slint/tests/manual/module-builds/app/ui/app-window.slint
Benny Sjöstrand 0bda0a64eb
Add support for importing Rust types from another crate Slint compilation (#9329)
To implement an external Slint library, the types and components implemented
in the .slint files needs to be exposed through the Rust crate.
A simple example example/app-library is added to demonstrate how to use this feature.

CC #7060
2025-09-16 09:01:44 +02:00

32 lines
799 B
Text

// Copyright © SixtyFPS GmbH <info@slint.dev>
// SPDX-License-Identifier: MIT
import { Button, VerticalBox } from "std-widgets.slint";
import { BLogicA, BLogicAAPI } from "@BLogicA";
import { BLogicB, BLogicBAPI } from "@BLogicB";
export component AppWindow inherits Window {
callback update-blogic-data();
VerticalBox {
BLogicA {}
BLogicB {}
Button {
text: "Crank me up!";
clicked => {
BLogicBAPI.crank-it({ magic-number: 42, cranks: [ "delta", "alfta", "sorta", "coso", "tokyo", "denia" ]});
}
}
Text {
text:BLogicBAPI.status;
}
}
Timer {
interval: 1s;
running: true;
triggered => {
root.update-blogic-data();
}
}
}