slint README

The project's README from github.com/slint-ui/slint. As one markdown file: README.md.

Slint Slint

Build Status REUSE status Discussions

Slint is an open-source declarative GUI toolkit for building native user interfaces for embedded systems, desktops, and mobile platforms.

Write your UI once in .slint, a simple markup language. Connect it to business logic written in Rust, C++, JavaScript, or Python.

Why Slint?

The name Slint is derived from our design goals:

Beyond the design goals, here’s what makes Slint stand out:

See what others have built: #MadeWithSlint

Examples

Embedded

RaspberryPi STM32 RP2040
Video of Slint on Raspberry Pi Video of Slint on STM32 Video of Slint on RP2040

Desktop

Windows macOS Linux
Screenshot of the Gallery on Windows Screenshot of the Gallery on macOS Screenshot of the Gallery on Linux

Web using WebAssembly

Printer Demo Slide Puzzle Energy Monitor Widget Gallery Weather demo
Screenshot of the Printer Demo Screenshot of the Slide Puzzle Screenshot of the Energy Monitor Demo Screenshot of the Gallery Demo Screenshot of the weather Demo

More examples and demos in the examples folder

Get Started

Hello World

The UI is defined in a Domain Specific Language that is declarative, easy to use, intuitive, and provides a powerful way to describe graphical elements, their placement, their hierarchy, property bindings, and the flow of data through the different states.

Here's the obligatory "Hello World":

export component HelloWorld inherits Window {
    width: 400px;
    height: 400px;

    Text {
       y: parent.width / 2;
       x: parent.x + 200px;
       text: "Hello, world";
       color: blue;
    }
}

Documentation

For more details, check out the Slint Documentation.

The examples folder contains examples and demos, showing how to use the Slint markup language and how to interact with a Slint user interface from supported programming languages.

The docs folder contains a lot more information, including build instructions, and internal developer docs.

Refer to the README of each language directory in the api folder:

Architecture

An application is composed of the business logic written in Rust, C++, Python, or JavaScript and the .slint user interface design markup, which is compiled to native code.

Architecture Overview

Compiler

The .slint files are compiled ahead of time. The expressions in the .slint are pure functions that the compiler can optimize. For example, the compiler could choose to "inline" properties and remove those that are constant or unchanged.

The compiler uses the typical compiler phases of lexing, parsing, optimization, and finally code generation. It provides different back-ends for code generation in the target language. The C++ code generator produces a C++ header file, the Rust generator produces Rust code, and so on. An interpreter for dynamic languages is also included.

Runtime

The runtime library consists of an engine that supports properties declared in the .slint language. Components with their elements, items, and properties are laid out in a single memory region, to reduce memory allocations.

Rendering backends and styles are configurable at compile time:

NOTE: When Qt is installed on the system, the qt style becomes available, using Qt's QStyle to achieve native looking widgets.

Tooling

We have a few tools to help with the development of .slint files:

Please check our Editors README for tips on how to configure your favorite editor to work well with Slint.

License

See LICENSE.md for the licensing terms of the whole repository, including documentation and examples.

You can use Slint under any of the following licenses, at your choice:

  1. Build proprietary desktop, mobile, or web applications for free with the Royalty-free License,
  2. Build open source embedded, desktop, mobile, or web applications for free with the GNU GPLv3,
  3. Build proprietary embedded, desktop, mobile, or web applications with the Commercial license.

See the Slint licensing options on the website and the Licensing FAQ.

Contributions

We welcome your contributions: in the form of code, bug reports or feedback. For contribution guidelines see CONTRIBUTING.md.

Frequently Asked Questions

Please see our separate FAQ.

About us (SixtyFPS GmbH)

We are passionate about software - API design, cross-platform software development and user interface components. Our aim is to make developing user interfaces fun for everyone: from Python, JavaScript, C++, or Rust developers all the way to UI/UX designers. We believe that software grows organically and keeping it open source is the best way to sustain that growth. Our team members are located remotely in Germany, Finland, and US.

Stay up to date

Contact us

Feel free to join Github discussions for general chat or questions. Use Github issues to report public suggestions or bugs.

We chat in our Mattermost instance where you are welcome to listen in or ask your questions.

You can of course also contact us privately via email to [email protected].

slint (slint-ui/slint)

Searching Database…

24.2K ·GitHub
这是什么?Slint 是一个开源的声明式 GUI 工具包,用于构建可在嵌入式系统、桌面、移动端和网页上运行的原生用户界面,业务逻辑可以用 Rust、C++、JavaScript 或 Python 编写。
这是一个 UI 框架,还是一套标记语言加编译工具链?两者兼有:你用 .slint 声明式标记语言编写界面,再由提前编译器将其转换为原生代码(如 C++ 头文件、Rust 代码等),并与你的业务逻辑连接起来。
我该如何开始用 Slint 构建 UI?先在 .slint 文件中编写界面,然后参照 api 文件夹下的入门模板和文档,将其与你选择的语言(Rust、C++、JavaScript/Node 或 Python)连接起来。
使用 Slint 需要哪些语言和工具?你需要一种受支持的宿主语言(Rust、C++、JavaScript/Node 或 Python)来驱动业务逻辑,以及 Slint 编译器/运行时;只有在需要通过 qt 样式获得原生外观的控件时,才可选择安装 Qt。
JavaScript 和 Python 绑定能用于生产环境吗?JavaScript/NodeJS 和 Python 的 API 都明确标注为测试版(Beta),因此与更成熟的 Rust 和 C++ API 相比,可能会有一些不完善之处。
Slint 只面向桌面应用,还是也支持嵌入式设备?它支持桌面端(Windows、macOS、Linux)、嵌入式硬件(树莓派、STM32、RP2040)、移动端,以及通过 WebAssembly 支持的网页端,并提供专为资源受限设备设计的轻量级运行时。
有哪些平台展示了运行 Slint 的应用?README 中展示了 Slint 在树莓派、STM32 和 RP2040 嵌入式开发板上运行,以原生桌面应用形式运行于 Windows/macOS/Linux,并通过 WebAssembly 演示在浏览器中运行。
使用 Slint 有哪些许可选择?你可以在以下几种许可中选择:适用于专有应用的免费免版税许可证、适用于开源项目的 GNU GPLv3,或适用于超出免费版条款的专有用途的付费商业许可证。
渲染是否需要 GPU?不需要。Slint 提供多种渲染后端:femtovg 和 Skia 使用 GPU 加速(OpenGL ES 2.0 / Skia),而软件渲染器完全依赖 CPU 运行,无需额外依赖。
Slint 为界面设计提供了哪些工具?它包括一个带自动补全和实时预览功能的 LSP 服务器(以 VS Code 扩展形式提供)、一个支持自动重载的 slint-viewer 工具、名为 SlintPad 的在线编辑器,以及用于导入设计稿的 Figma-to-Slint 插件。
Slint 支持哪些渲染后端?Slint 提供 femtovg 渲染器(OpenGL ES 2.0)、Skia 渲染器,以及仅依赖 CPU 运行的软件渲染器;若系统中已安装 Qt,还可以使用 qt 样式来获得原生外观的控件。
不安装任何东西,我能试用 Slint 吗?可以,SlintPad 是一个在线编辑器,让你直接在浏览器中体验 .slint 语法。
Creator
slint-ui
Size
100.2 MB
Stars
24.2K
Age
6y
Commits · 90 Days