WaylandCompositor QML Type
管理 Wayland 显示服务器。更多
Import Statement: | import QtWayland.Compositor |
In C++: | QWaylandCompositor |
属性
- additionalShmFormats : list<enum>
(since 6.0)
- created : bool
- defaultOutput : WaylandOutput
- defaultSeat : WaylandSeat
- extensions : list
- retainedSelection : bool
- socketName : string
- useHardwareIntegrationExtension : bool
信号
- void surfaceCreated(WaylandSurface surface)
- void surfaceRequested(WaylandClient client, int id, int version)
方法
- addSocketDescriptor(fd)
- destroyClient(client)
- destroyClientForSurface(surface)
详细说明
WaylandCompositor 管理与客户端的连接,以及不同的outputs 和seats 。
通常情况下,合成器应用程序只有一个 WaylandCompositor 实例,它可以有多个输出作为子实例。当客户端请求合成器创建曲面时,onSurfaceRequested 处理程序会处理该请求。
合成器支持的扩展应被实例化并添加到 extensions 属性中。
属性文档
additionalShmFormats : list<enum> |
此属性包含合成器支持的其他 wl_shm 格式列表。
默认情况下,只列出所需的 ShmFormat_ARGB8888 和 ShmFormat_XRGB8888,此列表将为空。其他格式可能需要内部转换,因此会影响性能。
此属性必须在合成器组件完成之前设置。随后的更改不会产生任何影响。
此属性在 Qt 6.0 中引入。
created : bool |
如果WaylandCompositor 已初始化,则此属性为 true,否则为 false。
defaultOutput : WaylandOutput |
该属性包含添加到WaylandCompositor 的输出列表中的第一个输出,如果没有添加输出,则该属性为空。
设置一个新的默认输出会将其预置到输出列表中,使其成为新的默认值,但之前的默认值不会从列表中移除。
defaultSeat : WaylandSeat |
此属性包含此WaylandCompositor 的默认席位。
extensions : list |
合成器向客户端宣传的扩展列表。对于合成器应支持的任何 Wayland 扩展,实例化其组件,并将其添加到扩展列表中。
例如,以下代码将允许客户端使用wl_shell
接口在合成器中请求wl_shell
曲面。
import QtWayland.Compositor WaylandCompositor { WlShell { // ... } }
retainedSelection : bool |
此属性表示是否启用了保留选择。
socketName : string |
该属性表示WaylandCompositor 与客户端通信时使用的套接字名称。必须在组件完成之前设置。
如果 socketName 为空(默认值),则会使用起始参数--wayland-socket-name
的内容。如果未设置该参数,合成器将尝试查找套接字名称,默认情况下该名称为wayland-0
。
useHardwareIntegrationExtension : bool |
该属性用于确定是否应为WaylandCompositor 启用硬件集成扩展。
该属性必须在合成器组件完成之前设置。
信号文档
void surfaceCreated(WaylandSurface surface) |
当创建了一个新的WaylandSurface 实例surface 时,将发出该信号。
注: 相应的处理程序是onSurfaceCreated
。
void surfaceRequested(WaylandClient client, int id, int version) |
当client 创建了一个 ID 为id 的曲面时,会发出此信号。接口version 也可用。
连接此信号的槽可在槽的作用域内创建并初始化一个WaylandSurface 实例。否则将创建一个默认的曲面。
注: 相应的处理程序是onSurfaceRequested
。
方法文档
addSocketDescriptor(fd) |
监听文件描述符fd 上的客户端连接,该文件描述符指向已绑定并监听的服务器套接字。
不拥有文件描述符的所有权;如果需要,必须显式关闭文件描述符。
注意: 此方法仅适用于 libwayland 1.10.0 或更新版本。如果使用较早的 libwayland 运行时,则此方法无效。
destroyClient(client) |
销毁给定的WaylandClient client 。
destroyClientForSurface(surface) |
销毁WaylandSurface surface 的客户端。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.