QWaylandSurfaceRole Class
QWaylandSurfaceRole 类表示表面在 wl_surface 上下文中的角色。更多内容...
| 头文件: | #include <QWaylandSurfaceRole> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS WaylandCompositor) target_link_libraries(mytarget PRIVATE Qt6::WaylandCompositor) |
| qmake: | QT += waylandcompositor |
公共函数
| QWaylandSurfaceRole(const QByteArray &name) | |
| const QByteArray | name() |
详细说明
QWaylandSurfaceRole 用于表示QWaylandSurface 的角色。根据协议规范,表面角色一旦设定即为永久性,若后续将同一表面重用于不同角色,则构成协议错误。将表面多次设置为同一角色并不构成错误。
例如,QWaylandXdgShell 可为表面分配“popup”或“toplevel”角色。如果对一个先前已接收过get_popup 请求的表面发出get_toplevel 请求,则合成器将报出协议错误。
角色通过指针值进行比较,因此任何两个 QWaylandSurfaceRole 对象都会被视为不同的角色,无论它们的names 是什么。分配角色的典型方法是使用一个静态的 QWaylandSurfaceRole 对象来表示它。
class MyShellSurfaceSubType
{
static QWaylandSurfaceRole s_role;
// ...
};
// ...
surface->setRole(&MyShellSurfaceSubType::s_role, resource->handle, MY_ERROR_CODE);成员函数文档
QWaylandSurfaceRole::QWaylandSurfaceRole(const QByteArray &name)
创建一个 QWaylandSurfaceRole 并将其名称设置为name 。该名称将用于涉及此 QWaylandSurfaceRole 的错误消息中。
const QByteArray QWaylandSurfaceRole::name()
返回“QWaylandSurfaceRole ”的名称。该名称用于涉及此“QWaylandSurfaceRole ”的错误消息中,例如在尝试更改曲面的角色时。
© 2026 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.