This project demonstrates how to integrate Slint UI with Kameo actor system. It shows how UI events like button clicks are sent as messages to actors, and how state changes in actors are reflected back to the UI.
sequenceDiagram
participant UI as Slint UI<br/>(AppWindow)
participant UIActor as UI Actor<br/>(UIActor)
participant CoreActor as Core Actor<br/>(CalculatorActor)
Note over UI,CoreActor: User clicks button
UI->>UIActor: UIInput::Add/Subtract/Reset
Note over UIActor,CoreActor: UI Actor forwards command to Core Actor
UIActor->>CoreActor: CoreCommand::Add/Subtract/Reset
Note over CoreActor: Core Actor updates internal state
CoreActor->>CoreActor: Internal state change (number)
Note over CoreActor,UIActor: Core Actor sends result to UI Actor
CoreActor->>UIActor: UICommand::SetValue(result)
Note over UIActor,UI: UI Actor updates Slint UI
UIActor->>UI: set_result(value)
Note over UI: New value displayed in UI
- Slint UI: Calculator interface (AppWindow)
- Add, Subtract, Reset buttons
- Result display
- Kameo Actor: CalculatorActor
- State (number) management
- Message (add, subtract, reset) handling
- User clicks a button in Slint UI
- UI event handler sends the corresponding message to Kameo actor
- CalculatorActor changes its state according to the message
- Updated state (result value) is reflected back to the UI
cargo run
- Slint: https://slint.dev
- Kameo: https://github.com/realcr/kameo
This sample can be used as a reference to implement various structures that integrate Slint UI with Kameo actor system.