Cargo Features

[dependencies]
slint = { version = "1.9.0", default-features = false, features = ["compat-1-2", "compat-1-0", "std", "gettext", "libm", "log", "serde", "software-renderer-systemfonts", "unsafe-single-threaded", "accessibility", "raw-window-handle-06", "backend-qt", "backend-winit", "backend-winit-x11", "backend-winit-wayland", "backend-default", "renderer-winit-femtovg", "renderer-winit-skia", "renderer-winit-skia-opengl", "renderer-winit-skia-vulkan", "renderer-winit-software", "renderer-femtovg", "renderer-skia", "renderer-skia-opengl", "renderer-skia-vulkan", "renderer-software", "backend-linuxkms", "backend-linuxkms-noseat", "backend-android-activity-06", "backend-android-activity-05", "document-features"] }
default = accessibility, backend-default, compat-1-2, renderer-femtovg, renderer-software, std

These default features are set whenever slint is added without default-features = false somewhere in the dependency tree.

compat-1-2 default compat-1-0?

Mandatory feature: This feature is required to keep the compatibility with Slint 1.2 Newer patch version may put current functionality behind a new feature that would be enabled by default only if this feature was added. More info in this blog post

compat-1-0 = compat-1-2, renderer-software
std default backend-linuxkms? backend-linuxkms-noseat? backend-qt? backend-winit? backend-winit-wayland? backend-winit-x11? renderer-femtovg renderer-skia? renderer-skia-opengl? renderer-skia-vulkan?

Enable use of the Rust standard library.

Enables std of i-slint-core

gettext

Enable the translations using gettext

the @tr(...) code from .slint files will be transformed into call to dgettext with the crate name as domain name

translations must be enabled with the init_translations! macro

Enables gettext-rs of i-slint-core

Affects private_unstable_api::init_translations

libm

This feature enables floating point arithmetic emulation using the libm crate. Use this in MCU environments where the processor does not support floating point arithmetic.

Enables libm of i-slint-core

log

If enabled, calls of debug() in .slint files use to the [log::debug!()] macro of the log crate instead of just println!().

Enables log

serde

Implement the serde::Serialize and serde::Deserialize for some of the base types such as SharedString and SharedVector.

Enables serde of i-slint-core

software-renderer-systemfonts = renderer-software

This feature enables the software renderer to pick up fonts from the operating system for text rendering.

Enables software-renderer-systemfonts of i-slint-core

unsafe-single-threaded

Slint uses internally some thread_local state.

When the std feature is enabled, Slint can use std::thread_local!, but when in a #![no_std] environment, we need a replacement. Using this feature, Slint will just use static variable disregarding Rust's Send and Sync safety

Safety : You must ensure that there is only one single thread that call into the Slint API

Enables unsafe-single-threaded of i-slint-core

accessibility default

Enable integration with operating system provided accessibility APIs
Enabling this feature will try to expose the tree of UI elements to OS provided accessibility APIs to support screen readers and other assistive technologies.

Enables accessibility of i-slint-backend-selector

raw-window-handle-06

Enable integration with raw-window-handle version 0.6. This provides a [Window::window_handle()] function that returns a struct that implements HasWindowHandle and HasDisplayHandle implementation.

Enables raw-window-handle, raw-window-handle-06 of i-slint-backend-selector

backend-qt = i-slint-backend-qt, std

Backends

Slint needs a backend that will act as liaison between Slint and the OS. By default, Slint will use the Qt backend, if Qt is installed, otherwise, it will use Winit with FemtoVG. Both backends are compiled in. If you want to not compile one of these you need to disable the default feature and re-enable one backend. It is also possible to use Slint without backend if you provide the platform abstraction yourself with [platform::set_platform()].

If you enable the Winit backend, you need to also include a renderer. renderer-femtovg is the only stable renderer, the other ones are experimental

It is also possible to select the backend and renderer at runtime when several are enabled, using the SLINT_BACKEND environment variable.

  • SLINT_BACKEND=Qt selects the Qt backend
  • SLINT_BACKEND=winit selects the winit backend
  • SLINT_BACKEND=winit-femtovg selects the winit backend with the FemtoVG renderer
  • SLINT_BACKEND=winit-skia selects the winit backend with the skia renderer
  • SLINT_BACKEND=winit-software selects the winit backend with the software renderer

If the selected backend is not available, the default will be used.

Here are the cargo features controlling the backend:

The Qt backend feature uses Qt for the windowing system integration and rendering. This backend also provides the native style. It requires Qt 5.15 or later to be installed. If Qt is not installed, the backend will not be operational

Enables backend-qt of i-slint-backend-selector

backend-winit = std

The winit crate is used for the event loop and windowing system integration. It supports Windows, macOS, web browsers, X11 and Wayland. X11 and wayland are only available when compiling for Linux or other Unix-like operating systems. With this feature, both X11 and Wayland are supported. For a smaller build, omit this feature and select one of the other specific backend-winit-XX features.

Enables backend-winit of i-slint-backend-selector

backend-winit-x11 = std

Simliar to backend-winit this enables the winit based event loop but only with support for the X Window System on Unix.

Enables backend-winit-x11 of i-slint-backend-selector

backend-winit-wayland = std

Simliar to backend-winit this enables the winit based event loop but only with support for the Wayland window system on Unix.

Enables backend-winit-wayland of i-slint-backend-selector

backend-default default = i-slint-backend-qt

Alias to a backend and renderer that depends on the platform.
Will select the Qt backend on linux if present, and the winit otherwise

Enables i-slint-backend-selector

renderer-winit-femtovg = renderer-femtovg

deprecated aliases

renderer-winit-skia = renderer-skia
renderer-winit-skia-opengl = renderer-skia-opengl
renderer-winit-skia-vulkan = renderer-skia-vulkan
renderer-winit-software = renderer-software
renderer-femtovg default renderer-winit-femtovg? = std

Render using the FemtoVG crate.

Enables i-slint-renderer-femtovg, renderer-femtovg of i-slint-backend-selector

Affects slint::platform.femtovg_renderer

renderer-skia renderer-winit-skia? = std

Render using Skia.

Enables renderer-skia of i-slint-backend-selector

renderer-skia-opengl renderer-winit-skia-opengl? = std

Same as renderer-skia, but Skia will always use OpenGL.

Enables renderer-skia-opengl of i-slint-backend-selector

renderer-skia-vulkan renderer-winit-skia-vulkan? = std

Same as renderer-skia, but Skia will always use Vulkan.

Enables renderer-skia-vulkan of i-slint-backend-selector

renderer-software default compat-1-0? renderer-winit-software? software-renderer-systemfonts?

Render using the software renderer.

Enables renderer-software of i-slint-backend-selector, software-renderer of i-slint-core

backend-linuxkms = std

KMS with Vulkan or EGL and libinput on Linux are used to render the application in full screen mode, without any windowing system. Requires libseat. If you don't have libseat, select backend-linuxkms-noseat instead. (Experimental)

Enables backend-linuxkms of i-slint-backend-selector

backend-linuxkms-noseat = std

KMS with Vulkan or EGL and libinput on Linux are used to render the application in full screen mode, without any windowing system. (Experimental)

Enables backend-linuxkms-noseat of i-slint-backend-selector

backend-android-activity-06

Use the backend based on the android-activity crate. (Using it's native activity feature)

Enables aa-06 and native-activity of i-slint-backend-android-activity

Affects slint::android

backend-android-activity-05

Deprecated Use previous version of android-activity. This is mutually exclusive with backend-android-activity-06.

Enables aa-05 and native-activity of i-slint-backend-android-activity

Affects slint::android

Features from optional dependencies

In crates that don't use the dep: syntax, optional dependencies automatically become Cargo features. These features may have been created by mistake, and this functionality may be removed in the future.

document-features implicit feature

Enables document-features

document-features:

Extract documentation for the feature flags from comments in Cargo.toml

i-slint-backend-android-activity android backend-android-activity-05? backend-android-activity-06?
i-slint-backend-qt linux backend-default backend-qt?