SlintPad
基于官方文档的个人翻译,主要使用 有道翻译。
Debugging Techniques - Slint 1.3.2 Reference
ADVANCED TOPICS 高级的主题--
- Debugging Techniques 调试技术
文章来源地址https://www.toymoban.com/news/detail-802570.html
Debugging Techniques 调试技术
On this page we share different techniques and tools we’ve built into Slint that help you track down different issues you may be running into, during the design and development.
在这个页面上,我们分享了我们在Slint中内置的不同技术和工具,这些技术和工具可以帮助您跟踪在设计和开发过程中可能遇到的不同问题。
Debugging Property Values 调试属性值
Use the debug() function to print the values of properties to stderr.
使用debug()函数将属性的值打印到stderr 标准错误。
Slow Motion Animations 慢动作动画
Animations in the user interface need to be carefully designed to have the correct duration and changes in element positioning or size need to follow an easing curve.
用户界面中的动画需要精心设计,以确保其具有正确的持续时间,元素位置或大小的变化需要遵循缓和曲线。
To inspect the animations in your application, set the SLINT_SLOW_ANIMATIONS
environment variable before running the program. This variable accepts an unsigned integer value that is the factor by which to globally slow down the steps of all animations, automatically. This means that you don’t have to make any manual changes to the .slint
markup and recompile. For example,SLINT_SLOW_ANIMATIONS=4
slows down animations by a factor of four.
要检查应用程序中的动画,请在运行程序之前设置SLINT_SLOW_ANIMATIONS环境变量。该变量接受一个无符号整数值,该数值是全局自动减慢所有动画步骤的因子。这意味着您不必对.slint标记进行任何手动更改并重新编译。例如,SLINT_SLOW_ANIMATIONS=4将动画的速度降低到原来的四倍。
User Interface Scaling 用户界面扩展
The use of logical pixel lengths throughout .slint
files lets Slint compute the number of physical pixels, dynamically, depending on the device-pixel ratio of the screen. To get an impression of how the individual elements look like when rendered on a screen with a different device-pixel ratio, set the SLINT_SCALE_FACTOR
environment variable before running the program. This variable accepts a floating pointer number that is used to convert logical pixel lengths to physical pixel lengths. For example, SLINT_SCALE_FACTOR=2
renders the user interface in a way where every logical pixel has twice the width and height.
通过在. Slint文件中使用逻辑像素长度,Slint可以根据屏幕的设备像素比动态地计算物理像素的数量。要了解单个元素在具有不同设备像素比的屏幕上呈现时的样子,请在运行程序之前设置SLINT_SCALE_FACTOR环境变量。该变量接受一个浮点指针数,用于将逻辑像素长度转换为物理像素长度。例如,SLINT_SCALE_FACTOR=2以一种方式呈现用户界面,其中每个逻辑像素具有两倍的宽度和高度。
Note: Currently, only the FemtoVG and Skia renderers support this environment variable.
注意:目前,只有FemtoVG和Skia渲染器支持这个环境变量。
Debugging for Performance Improvements 调试性能改进
Slint attempts to use hardware-acceleration to ensure that rendering the user interface consumes a minimal amount of CPU resources while maintaining smooth animations. However, depending on the complexity of the user interface, quality of the graphics drivers, or the power of the GPU in your system, you may hit limits and experience slowness. To address this issue, set the SLINT_DEBUG_PERFORMANCE
environment variable before running the program, to inspect the frame rate. The following options affect the frame rate inspection and reporting:
Slint尝试使用硬件加速来确保呈现用户界面消耗最少的CPU资源,同时保持平滑的动画。但是,根据用户界面的复杂性、图形驱动程序的质量或系统中GPU的功率,您可能会遇到限制并经历缓慢。要解决这个问题,可以在运行程序之前设置SLINT_DEBUG_PERFORMANCE环境变量,以检查帧速率。以下选项影响帧率检查和报告:
-
refresh_lazy
: The frame rate is measured only when an actual frame is rendered, for example due to a running animation, user interaction, or some other state change that results in a visual difference in the user interface. If there is no change, a low frame rate is reported. Use this option to verify that no unnecessary repainting happens when there are no visual changes. For example, in a user interface that shows a text input field with a cursor that blinks once per second, the reported frame rate should be two. refresh_lazy:帧率仅在呈现实际帧时测量,例如由于正在运行的动画、用户交互或其他一些导致用户界面视觉差异的状态变化。如果没有变化,则报告低帧率。使用此选项可验证在没有视觉更改时不会发生不必要的重新绘制。例如,在显示文本输入字段的用户界面中,光标每秒闪烁一次,报告的帧率应该是2。 -
refresh_full_speed
: The user interface is continuously refreshed, even if nothing is changed. This continuous refresh results in a higher load on the system. Use this option to identify any bottlenecks that prevent you from achieving smooth animations. Also disables partial rendering with the software renderer. refresh_full_speed:持续刷新用户界面,即使没有更改。这种持续刷新会导致系统负载增加。使用此选项可以识别任何阻碍实现平滑动画的瓶颈。还禁止使用软件渲染器进行部分渲染。 -
console
: The frame rate is printed tostderr
on the console. console:将帧速率打印到控制台上。 -
overlay
: The frame rate is as an overlay text label on top of the user interface in each window. 叠加:帧率作为每个窗口中用户界面顶部的叠加文本标签。
Use these options in combination, separated by a comma. You must select a combination of one frame rate measurement method and a reporting method. For example, SLINT_DEBUG_PERFORMANCE=refresh_full_speed,overlay
repeatedly re-renders the entire user interface in each window and prints the achieved frame rate in the top-left corner. In comparison, SLINT_DEBUG_PERFORMANCE=refresh_lazy,console,overlay
measures the frame rate only when something in the user interface changes and the measured value is printed to stderr
as well as rendered as an overlay text label.
组合使用这些选项,以逗号分隔。必须选择一种帧率测量方法和一种上报方法的组合。例如,SLINT_DEBUG_PERFORMANCE=refresh_full_speed,overlay重复地在每个窗口中重新呈现整个用户界面,并在左上角打印实现的帧率。相比之下,SLINT_DEBUG_PERFORMANCE=refresh_lazy,console,overlay仅在用户界面发生变化时测量帧速率,并且测量值被打印到stderr并作为覆盖文本标签呈现。
The environment variable must be set before running the program. If the application runs on a microcontroller without the standard library, the environment variable must be set during compilation.
必须在运行程序之前设置环境变量。如果应用程序在没有标准库的微控制器上运行,则必须在编译期间设置环境变量。
Next 下一个
Selecting a Widget Style 选择小部件样式
Selecting a Widget Style - Slint 1.3.2 Reference
Selecting a Widget Style 选择小部件样式
Slint offers a variety of built-in widgets which can be imported from "std-widgets.slint"
. You can modify the look of these widgets by choosing a style.
Slint提供了各种内置小部件,可以从“std-widgets.slint”导入。您可以通过选择样式来修改这些小部件的外观。
The styles available include:
可用的样式包括:
Style Name 风格名 |
Light Variant 光变体 |
Dark Variant 暗变体 |
Description 描述 |
---|---|---|---|
流畅 |
fluent-light |
fluent-dark |
These variants belong to the Fluent style, which is based on the Fluent Design System. 这些变体属于基于Fluent设计系统的Fluent样式。 |
|
material-light |
material-dark |
These variants are part of the Material style, which follows the Material Design. 这些变体是材质风格的一部分,遵循材质设计 |
cupertino |
cupertino-light |
cupertino-dark |
The Cupertino variants emulate the style used by macOS. Cupertino 变体模仿了 macOS 使用的样式。 |
qt |
The Qt style uses Qt to render widgets. This style requires Qt to be installed on your system. Qt 样式使用 Qt 来呈现小部件。这种样式要求在系统上安装 Qt |
||
|
This is an alias to one of the other styles depending on the platform. It is 这是其他样式的别名,具体取决于平台。它在 macOS 上是 Cupertino,在 Windows 上是流利的,在 Android 上是材料,在 linux 上是 Qt (如果 Qt 可用的话) ,或者在其他方面是流利的。 |
By default, the styles automatically adapt to the system’s dark or light color setting. Select a -light
or -dark
variant to override the system setting and always show either dark or light colors.
默认情况下,样式会自动适应系统的深色或浅色设置。选择-light或-dark变体来覆盖系统设置,并始终显示深色或浅色。
The widget style is determined at your project’s compile time. The method to select a style depends on how you use Slint.
小部件样式是在项目编译时确定的。选择样式的方法取决于您如何使用Slint。
If no style is selected, native
is the default.
如果没有选择样式,则默认为native。
Selecting a Widget Style with Rust:
用Rust选择Widget样式:
You can select the style before starting your compilation by setting the SLINT_STYLE
environment variable to the name of your chosen style.
在开始编译之前,可以通过将SLINT_STYLE环境变量设置为所选样式的名称来选择样式。
When using the slint_build
API, call the slint_build::compile_with_config() function.
当使用slint_build API时,调用slint_build::compile_with_config()函数。
When using the slint_interpeter
API, call the slint_interpreter::ComponentCompiler::set_style() function.
当使用slint_interpeter API时,调用slint_interpreter::ComponentCompiler::set_style()函数。
Selecting a Widget Style when using C++
在使用c++时选择小部件样式
Define a SLINT_STYLE
CMake cache variable to contain the style name as a string. This can be done, for instance, on the command line:
定义一个SLINT_STYLE CMake缓存变量,以字符串形式包含样式名。这可以做到,例如,在命令行:
cmake -DSLINT_STYLE="material" /path/to/source /源/路径
Previewing Designs With slint-viewer 用slint-viewer预览设计
Select the style either by setting the SLINT_STYLE
environment variable, or by passing the style name with the --style
argument:
通过设置SLINT_STYLE环境变量或通过--style参数传递样式名来选择样式:
slint-viewer –style material /path/to/design.slint // 查看器样式的材料
Previewing Designs With The Slint Visual Studio Code Extension
用Slint Visual Studio代码扩展来预览设计
To select the style, first open the Visual Studio Code settings editor:
要选择样式,首先打开Visual Studio Code设置编辑器:
-
On Windows/Linux - File > Preferences > Settings 在Windows/Linux上-文件>首选项>设置
-
On macOS - Code > Preferences > Settings 在macOS上-代码>首选项>设置
Then enter the style name in Extensions > Slint > Preview:Style
然后在Extensions > Slint > Preview: style中输入样式名称
Previewing Designs With The Generic LSP Process
使用通用LSP进程预览设计
Choose the style by setting the SLINT_STYLE
environment variable before launching the process. Alternatively, if your IDE integration allows for command line parameters, you can specify the style using --style
.
在启动进程之前,通过设置SLINT_STYLE环境变量来选择样式。或者,如果您的IDE集成允许命令行参数,您可以使用--style指定样式。
Next 下一个
Backends & Renderers 后端和渲染器
Backends & Renderers - Slint 1.3.2 Reference
Backends & Renderers 后端和渲染器
In Slint, a backend is the module that encapsulates the interaction with the operating system, in particular the windowing sub-system. Multiple backends can be compiled into Slint and one backend is selected for use at run-time on application start-up. You can configure Slint without any built-in backends, and instead develop your own backend by implementing Slint’s platform abstraction and window adapter interfaces.
在Slint中,后端是封装与操作系统(特别是窗口子系统)交互的模块。多个后端可以编译成Slint,并在应用程序启动时选择一个后端用于运行时。您可以在没有任何内置后端的情况下配置Slint,并且可以通过实现Slint的平台抽象和窗口适配器接口来开发自己的后端。
The backend is selected as follows: 后端选择如下:
-
The developer provides their own backend and sets it programmatically. 开发人员提供他们自己的后端,并通过编程方式进行设置。
-
Else, the backend is selected by the value of the
SLINT_BACKEND
environment variable, if it is set. 否则,如果设置了SLINT_BACKEND环境变量,则通过该变量的值来选择后端。 -
Else, backends are tried for initialization in the following order: 否则,按以下顺序尝试初始化后端:
-
qt
-
winit
-
linuxkms
-
The following table provides an overview over the built-in backends. For more information about the backend’s capabilities and their configuration options, see the respective sub-pages.
下表提供了对内置后端的概述。有关后端功能及其配置选项的更多信息,请参阅相应的子页面。
Backend Name 后端名称 |
Description 描述 | Built-in by Default 默认内置 |
---|---|---|
qt | The Qt library is used for windowing system integration, rendering, and native widget styling. Qt库用于窗口系统集成、呈现和本机小部件样式。 |
Yes (if Qt installed) 是(如果安装了Qt) |
winit | The 的winit library is used to interact with the windowing system. winit库用于与窗口系统交互。 |
Yes 是的 |
linuxkms | Linux's KMS/DRI infrastructure is used for rendering. No windowing system or compositor is required. Linux的KMS/DRI基础架构用于渲染。不需要窗口系统或合成器。 |
No 没有 |
A backend is also responsible for selecting a renderer. See the Renderers section for an overview. Override the choice of renderer by adding the name to the SLINT_BACKEND
environment variable, separated by a dash. For example if you want to choose the winit
backend in combination with the software
renderer, set SLINT_BACKEND=winit-software
. Similarly, SLINT_BACKEND=linuxkms-skia
chooses the linuxkms
backend and then instructs the LinuxKMS backend to use Skia for rendering.
后端还负责选择渲染器。有关概述,请参阅Renderers部分。通过将名称添加到SLINT_BACKEND环境变量(用破折号分隔)来覆盖渲染器的选择。例如,如果您希望选择winit后端与软件渲染器相结合,则设置SLINT_BACKEND=winit-software。类似地,SLINT_BACKEND=linuxkms- Skia选择linuxkms后端,然后指示linuxkms后端使用Skia进行呈现。
Renderers 渲染器
Slint comes with different renderers that use different techniques and libraries to turn your scene of elements into pixels. Slint picks a renderer backend on your choice of Backend as well as the features you’ve selected at Slint compilation time.
Slint带有不同的渲染器,使用不同的技术和库将元素场景转换为像素。Slint根据您选择的后端以及您在Slint编译时选择的特性来选择渲染器后端。
Qt Renderer Qt渲染器
The Qt renderer comes with the Qt backend and renders using QPainter:
Qt渲染器自带Qt后端,并使用QPainter进行渲染:
-
Software rendering, no GPU acceleration. 软件渲染,无GPU加速。
-
Available only in the Qt backend. 仅在Qt后端可用。
Software Renderer 软件渲染器
-
Runs anywhere, highly portable, and lightweight. 可在任何地方运行,高度可移植性和轻量级。
-
Software rendering, no GPU acceleration. 软件渲染,无GPU加速。
-
Supports partial rendering. 支持部分渲染。
-
Supports line-by-line rendering (Rust only). 支持逐行渲染(仅限Rust)。
-
Suitable for Microcontrollers. 适用于微控制器。
-
Some features haven’t been implemented yet: 有些功能还没有实现:
-
No support for
Path
. 不支持Path。 -
No image rotation or smooth scaling. 没有图像旋转或平滑缩放。
-
No support for
drop-shadow-*
properties. 不支持dropshadow -*属性。 -
No support for
border-radius
in combination withclip: true
. 不支持与clip: true组合使用border-radius。 -
No circular gradients. 没有圆形梯度。
-
-
Text rendering currently limited to western scripts. 文本渲染目前仅限于西方文字。
-
Available in the Winit backend. 在Winit后端可用。
-
Public Rust and C++ API. 公共Rust和c++ API。
FemtoVG Renderer FemtoVG渲染器
-
Highly portable. 具有高度的可移植性。
-
GPU acceleration with OpenGL (required). GPU加速与OpenGL(必需)。
-
Text and path rendering quality sometimes sub-optimal. 文本和路径渲染质量有时不是最佳的。
-
Available in the Winit backend and LinuxKMS backend. 可在Winit后端和LinuxKMS后端使用。
-
Public Rust API. 公共Rust API。
Skia Renderer Skia渲染器
-
Sophisticated GPU acceleration with OpenGL, Metal, Vulkan, and Direct3D. 先进的GPU加速与OpenGL,Metal,Vulkan和Direct3D。
-
Heavy disk-footprint compared to other renderers. 与其他渲染器相比,磁盘占用较大。
-
Available in the Winit backend and LinuxKMS backend. 可在Winit后端和LinuxKMS后端使用。
-
Public C++ API. 公共c++ API。
Troubleshooting 故障排除
You may run into compile issues when enabling the Skia renderer. The following sections track issues we’re aware of and how to resolve them.
启用Skia渲染器时,您可能会遇到编译问题。以下部分跟踪我们所知道的问题以及如何解决它们。
-
Compilation error on Windows with messages about multiple source files and unused linker input Windows上的编译错误,有关于多个源文件和未使用的链接器输入的消息
You may see compile errors that contain this error and warning from clang-cl: 您可能会看到包含此错误的编译错误和clang-cl的警告:
clang-cl: error: cannot specify '/Foobj/src/fonts/fontmgr_win.SkFontMgr_indirect.obj' when compiling multiple source files clang-cl: warning: Hausmann/.cargo/registry/src/index.crates.io-6f17d22bba15001f/skia-bindings-0.66.0/skia: 'linker' input unused [-Wunused-command-line-argument]
The Skia sources are checked out in a path that’s managed by Cargo, the Rust package manager. The error happens when that path contains spaces. By default that’s in
%HOMEPATH%\.cargo
, which contains spaces if the login name contains spaces. To resolve this issue, set theCARGO_HOME
environment variable to a path without spaces, such asc:\cargo_home
. Skia来源在Rust包经理Cargo管理的路径中进行检查。当该路径包含空格时,会发生错误。默认情况下,它位于%HOMEPATH%\.forge中,如果登录名包含空格,则包含空格。要解决此问题,请将CARGO_HOME环境变量设置为不带空格的路径,例如c:\CARGO_HOME。 -
Compilation error when compiling for ARMv7 with hardware floating-pointer support 编译支持硬件浮点指针的ARMv7时出现编译错误
You may see compiler errors that contain this message: 您可能会看到包含以下消息的编译器错误:
Unable to generate bindings: ClangDiagnostic("/home/runner/work/slint/yocto-sdk/sysroots/cortexa15t2hf-neon-poky-linux-gnueabi/usr/include/gnu/stubs-32.h:7:11: fatal error: 'gnu/stubs-soft.h' file not found\n")
The Skia build invokes clang in multiple occasions and is sensitive to compiler flags that affect the floating point abi (such as
-mfloat-abi=hard
), as they affect header file lookups. Skia构建在多个场合调用clang,并且对影响浮点abi的编译器标志(例如-mfloat-abi=hard)很敏感,因为它们会影响头文件查找。
The solve this, set the BINDGEN_EXTRA_CLANG_ARGS
environment variable to contain the same flags that your build environment also passes to the C++ compiler.
要解决这个问题,将BINDGEN_EXTRA_CLANG_ARGS环境变量设置为包含构建环境也传递给c++编译器的相同标志。
For example, if you’re building against a Yocto SDK, then you can find these flags in the OECORE_TUNE_CCARGS
environment variable.
例如,如果您正在针对Yocto SDK进行构建,那么您可以在OECORE_TUNE_CCARGS环境变量中找到这些标志。
Next 下一个
Qt Backend Qt的后端
Qt Backend - Slint 1.3.2 Reference
Qt Backend Qt的后端
The Qt backend uses the Qt library to interact with the windowing system, for rendering, as well as widget style for a native look and feel.
Qt后端使用Qt库与窗口系统进行交互,用于渲染,以及用于本地外观和感觉的小部件样式。
The Qt backend supports practically all relevant operating systems and windowing systems, including macOS, Windows, Linux with Wayland and X11, and direct full-screen rendering via KMS or proprietary drivers.
Qt后端支持几乎所有相关的操作系统和窗口系统,包括macOS, Windows, Linux与Wayland和X11,并通过KMS或专有驱动程序直接全屏渲染。
The Qt backend only supports software rendering at the moment. That means it runs with any graphics driver, but it does not utilize GPU hardware acceleration.
Qt后端目前只支持软件渲染。这意味着它可以与任何图形驱动程序一起运行,但它不利用GPU硬件加速。
Configuration Options 配置选项
The Qt backend reads and interprets the following environment variables:
Qt后端读取和解释以下环境变量:
Name 名字 |
Accepted Values 接受的值 |
Description 描述 |
---|---|---|
SLINT_FULLSCREEN |
any value 任何值 | If this variable is set, every window is shown in fullscreen mode. 如果设置了这个变量,每个窗口都以全屏模式显示。 |
Next 下一个
Winit Backend Winit后端
Winit Backend - Slint 1.3.2 Reference
Winit Backend Winit后端
The Winit backend uses the winit library to interact with the windowing system.
Winit后端使用Winit库与窗口系统进行交互。
The Winit backend supports practically all relevant operating systems and windowing systems, including macOS, Windows, Linux with Wayland and X11.
Winit后端支持几乎所有相关的操作系统和窗口系统,包括macOS, Windows, Linux与Wayland和X11。
The Winit backend supports different renderers. They can be explicitly selected for use through the SLINT_BACKEND
environment variable.
Winit后端支持不同的渲染器。它们可以通过SLINT_BACKEND环境变量显式地选择使用。
Renderer name 渲染器名 | Supported/Required Graphics APIs 支持/需要的图形api |
SLINT_BACKEND值来选择渲染器 |
---|---|---|
FemtoVG | OpenGL | winit-femtovg |
Skia | OpenGL, Metal, Direct3D, Software-rendering OpenGL, Metal, Direct3D,软件渲染 | winit-skia |
Skia Software Skia软件 | Software-only rendering with Skia Skia的纯软件渲染 |
winit-skia-software |
software 软件。 | Software-rendering, no GPU required 软件渲染,不需要GPU |
winit-software |
Configuration Options 配置选项
The Winit backend reads and interprets the following environment variables:
Winit后端读取并解释以下环境变量:
Name 名字 | Accepted Values 接受的值 |
Description 描述 |
---|---|---|
SLINT_FULLSCREEN |
any value 任何值 | If this variable is set, every window is shown in fullscreen mode. 如果设置了这个变量,每个窗口都以全屏模式显示。 |
Next 下一个
LinuxKMS Backend LinuxKMS后端
LinuxKMS Backend - Slint 1.3.2 Reference
LinuxKMS Backend LinuxKMS后端
The LinuxKMS backend runs only on Linux and eliminates the need for a windowing system such as Wayland or X11. Instead it uses the following libraries and interface to render directly to the screen and react to touch, mouse, and keyboard input.
LinuxKMS后端仅在Linux上运行,并且消除了对Wayland或X11等窗口系统的需求。相反,它使用以下库和接口直接呈现到屏幕上,并对触摸、鼠标和键盘输入做出反应。
-
OpenGL via KSM/DRI. OpenGL通过KSM/DRI。
-
Vulkan via the Vulkan KHR Display Extension. Vulkan通过Vulkan KHR显示扩展。
-
libinput for input event handling from mice, touch screens, or keyboards. Libinput用于处理来自鼠标、触摸屏或键盘的输入事件。
-
libseat for GPU and input device access without requiring root access. libseat用于GPU和输入设备访问,而不需要root访问。
The LinuxKMS backend supports different renderers. They can be explicitly selected for use through the SLINT_BACKEND
environment variable.
LinuxKMS后端支持不同的渲染器。它们可以通过SLINT_BACKEND环境变量显式地选择使用。
Renderer name 渲染器名 |
Required Graphics APIs 所需图形api |
|
---|---|---|
FemtoVG | OpenGL ES 2.0 opengles2.0 | linuxkms-femtovg |
Skia | OpenGL ES 2.0, Vulkan |
linuxkms-skia-opengl or 或linuxkms-skia-vulkan
|
Note 注意
This backend is still experimental. The backend has not undergone a great variety of testing on different devices and there are known issues.
这个后端仍然是实验性的。后端还没有在不同的设备上进行大量的测试,并且存在一些已知的问题。
Display Selection with OpenGL 用OpenGL选择显示
FemtoVG uses OpenGL, and Skia - unless Vulkan is enabled - uses OpenGL, too. Linux’s direct rendering manager (DRM) subsystem is used to configure display outputs. Slint defaults to selecting the first connected display and configures it at either its preferred resolution (if available) or its highest. Set the SLINT_DRM_OUTPUT
environment variable to select a specific display. To get a list of available outputs, set SLINT_DRM_OUTPUT
to list
.
FemtoVG使用OpenGL, Skia(除非Vulkan被启用)也使用OpenGL。Linux的直接呈现管理器(DRM)子系统用于配置显示输出。Slint默认选择第一个连接的显示器,并将其配置为首选分辨率(如果可用)或最高分辨率。设置SLINT_DRM_OUTPUT环境变量以选择特定的显示。要获得可用输出的列表,请将SLINT_DRM_OUTPUT设置为list。
For example, the output may look like this on a laptop with a built-in screen (eDP-1) and an externally connected monitor (DP-3):
例如,在带有内置屏幕(eDP-1)和外部连接显示器(DP-3)的笔记本电脑上,输出可能如下所示:
DRM Output List Requested: eDP-1 (connected: true) DP-1 (connected: false) DP-2 (connected: false) DP-3 (connected: true) DP-4 (connected: false)
Setting SLINT_DRM_OUTPUT
to DP-3
will render on the second monitor.
将SLINT_DRM_OUTPUT设置为DP-3将在第二台显示器上呈现。
Display Selection with Vulkan 用Vulkan选择显示
When Skia’s Vulkan feature is enabled, Skia will attempt use Vulkan’s KHR Display extension to render directly to a connected screen. Slint defaults to selecting the first connected display and configures it at its highest available resolution and refresh rate. Set the SLINT_VULKAN_DISPLAY
environment variable to select a specific display. To get a list of available outputs, set SLINT_VULKAN_DISPLAY
to list
.
当Skia的Vulkan功能启用时,Skia将尝试使用Vulkan的KHR显示扩展直接渲染到连接的屏幕。Slint默认选择第一个连接的显示器,并将其配置为最高可用分辨率和刷新率。设置SLINT_VULKAN_DISPLAY环境变量以选择特定的显示。要获得可用输出的列表,请将SLINT_VULKAN_DISPLAY设置为list。
For example, the output may look like this on a laptop with a built-in screen (index 0) and an externally connected monitor (index 1):
例如,在具有内置屏幕(索引0)和外部连接显示器(索引1)的笔记本电脑上,输出可能如下所示:
Vulkan Display List Requested: Index: 0 Name: monitor Index: 1 Name: monitor
Setting SLINT_VULKAN_DISPLAY
to 1
will render on the second monitor.
将SLINT_VULKAN_DISPLAY设置为1将在第二台显示器上呈现。
To select a specific resolution and refresh rate (mode), set the SLINT_VULKAN_MODE
variable. Set it to list
to get a list of available modes. For example the output could look like this:
要选择特定的分辨率和刷新率(模式),请设置SLINT_VULKAN_MODE变量。将其设置为list以获取可用模式的列表。例如,输出可能像这样:
Vulkan Mode List Requested: Index: 0 Width: 3840 Height: 2160 Refresh Rate: 60 Index: 1 Width: 3840 Height: 2160 Refresh Rate: 59 Index: 2 Width: 3840 Height: 2160 Refresh Rate: 50 Index: 3 Width: 3840 Height: 2160 Refresh Rate: 30 Index: 4 Width: 3840 Height: 2160 Refresh Rate: 29 Index: 5 Width: 2560 Height: 1440 Refresh Rate: 59 Index: 6 Width: 1920 Height: 1080 Refresh Rate: 60 Index: 7 Width: 1920 Height: 1080 Refresh Rate: 59 Index: 8 Width: 1920 Height: 1080 Refresh Rate: 50 Index: 9 Width: 1680 Height: 1050 Refresh Rate: 59 ...
Set SLINT_VULKAN_MODE
to 6
to select 1920x1080@60.
设置“SLINT_VULKAN_MODE”为6,选择“1920x1080@60”。
Configuring the Keyboard 配置键盘
By default the keyboard layout and model is assumed to be a US model and layout. Set the following environment variables to configure support for different keyboards:
默认情况下,假定键盘布局和模型为美国模型和布局。设置以下环境变量以配置对不同键盘的支持:
-
XKB_DEFAULT_LAYOUT
: A comma separated list of layouts (languages) to include in the keymap. See the layouts section in xkeyboard-config(7) for a list of accepted language codes. for a list of supported layouts. XKB_DEFAULT_LAYOUT:要包含在keymap中的布局(语言)的逗号分隔列表。请参阅xkeyboard-config(7)中的布局部分,以获取可接受的语言代码列表。以获取支持的布局列表。 -
XKB_DEFAULT_MODEL
: The keyboard model by which to interpreter keys. See the models section in xkeyboard-config(7) for a list of accepted model codes. XKB_DEFAULT_MODEL:用来解释键的键盘模型。请参阅xkeyboard-config(7)中的模型部分,以获取可接受的模型代码列表。 -
XKB_DEFAULT_VARIANT
: A comma separated list of variants, one per layout, which configures layout specific variants. See the values in parentheses in the layouts section in xkeyboard-config(7) for a list of accepted variant codes. XKB_DEFAULT_VARIANT:一个逗号分隔的变体列表,每个布局一个,它配置特定于布局的变体。查看xkeyboard-config(7)的布局部分中括号中的值,以获得可接受的变体代码列表。 -
XKB_DEFAULT_OPTIONS
: A comma separated list of options to configure layout-independent key combinations. See the options section in xkeyboard-config(7) for a list of accepted option codes. XKB_DEFAULT_OPTIONS:一个逗号分隔的选项列表,用于配置与布局无关的键组合。请参阅xkeyboard-config(7)中的options部分,以获取可接受的选项代码列表。
(终于结束了,感谢观看啊)文章来源:https://www.toymoban.com/news/detail-802570.html
到了这里,关于slint 1.3.2 官方文档翻译06的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!