slint/demos
Nathan Collins d1be6f69fd printerdemo_mcu PrinterQueueItem uses a status string
Use a string instead of the JobStatus enum.

This makes the PrinterQueue code compatible with the printerdemo code,
allowing us to switch between mcu and non-mcu versions of this demo,
depending on what will fit on a device.

A string is used, rather than porting the non-mcu demo to an enum,
because the non-mcu demo needs to work with the cpp_interpreted demo.
2025-01-02 13:54:53 +01:00
..
energy-monitor Bump version number to 1.9.2 2024-12-30 10:18:16 +00:00
home-automation Bump version number to 1.9.2 2024-12-30 10:18:16 +00:00
printerdemo Use the zephyr,touch device tree entry for input handling 2025-01-02 13:52:18 +01:00
printerdemo_mcu printerdemo_mcu PrinterQueueItem uses a status string 2025-01-02 13:54:53 +01:00
weather-demo Bump version number to 1.9.2 2024-12-30 10:18:16 +00:00
CMakeLists.txt Move printer demo and energy-monitor into new top-level demos/ folder 2024-10-25 12:09:32 +02:00
README.md 1.9 Organise docs folder. (#7005) 2024-12-05 15:40:04 +02:00

Demos

These demos showcase different complex use-cases for building UIs with Slint.

Thumbnail Description Demo
Printer UI Printer Demo image A fictional user interface for the touch screen of a printer.
Project...
Wasm Demo
Energy MeterEnergy meter demo image A fictional user interface of a device that monitors energy consumption in a building.
Project...
Wasm Demo
WeatherWeather demo image A simple, cross-platform (Desktop, Android, Wasm) weather application using real weather data from the OpenWeather API.
Project...
Wasm Demo

Running the Rust Demos

You can run the examples either by going into folder or into the rust sub-folder and use cargo run, for example:

cd demos/printerdemo/rust
cargo run --release

or you can run them from anywhere in the Cargo workspace by name:

cargo run --release --bin printerdemo

Wasm builds

In order to make the wasm build of the example, you first need to edit the Cargo.toml files to uncomment the line starting with #wasm# (or use the sed line bellow) You can then use wasm-pack (which you may need to obtain with cargo install wasm-pack). This will generate the wasm in the ./pkg directory, which the index.html file will open. Since wasm files cannot be served from file:// URL, you need to open a wab server to serve the content

cd demos/printerdemo/rust
sed -i "s/^#wasm# //" Cargo.toml
wasm-pack build --release --target web
python3 -m http.server

Running the C++ Examples

  • When compiling Slint from sources: If you follow the C++ build instructions, this will build the C++ examples as well by default
  • From installed binary packages: Simply run cmake in one of the example directory containing a CMakeLists.txt
mkdir build && cd build
cmake -GNinja -DCMAKE_PREFIX_PATH="<path to installed>" ..
cmake --build .

Running the Node Examples

You can run the examples by going into the node sub-folder and use pnpm, for example:

cd demos/printerdemo/node
pnpm install
pnpm start