Skip to content

cellaxon/slint_and_kameo_test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Slint UI + Kameo Actor Sample Project

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.


Overall Structure and Message Flow

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
Loading

Main Components

  • Slint UI: Calculator interface (AppWindow)
    • Add, Subtract, Reset buttons
    • Result display
  • Kameo Actor: CalculatorActor
    • State (number) management
    • Message (add, subtract, reset) handling

How It Works

  1. User clicks a button in Slint UI
  2. UI event handler sends the corresponding message to Kameo actor
  3. CalculatorActor changes its state according to the message
  4. Updated state (result value) is reflected back to the UI

Build and Run

cargo run

References


This sample can be used as a reference to implement various structures that integrate Slint UI with Kameo actor system.

About

Slint with Kameo Actor

Resources

Stars

Watchers

Forks