WaylandSeat QML Type
提供对键盘、鼠标和触摸输入的访问。更多
Import Statement: | import QtWayland.Compositor |
In C++: | QWaylandSeat |
信号
- void cursorSurfaceRequest(QWaylandSurface surface, int hotspotX, int hotspotY)
- void keyboardFocusChanged(QWaylandSurface newFocus, QWaylandSurface oldFocus)
方法
- void sendKeyEvent(int qtKey, bool pressed)
- void sendTouchCancelEvent(WaylandClient client)
- void sendTouchFrameEvent(WaylandClient client)
- void sendTouchPointMoved(WaylandSurface surface, int id, point position)
- uint sendTouchPointPressed(WaylandSurface surface, int id, point position)
- void sendTouchPointReleased(WaylandSurface surface, int id, point position)
- void sendUnicodeKeyPressEvent(uint unicode)
(since 6.7)
- void sendUnicodeKeyReleaseEvent(uint unicode)
(since 6.7)
详细说明
WaylandSeat 类型可访问不同类型的用户输入,并保持键盘焦点和鼠标指针。它与 Wayland 协议中的 wl_seat 接口相对应。
信号文档
当客户端请求将特定的surface 作为鼠标指针时,就会发出该信号。例如,当用户将鼠标悬停在某一特定表面上,并希望光标变成一个调整大小的箭头时。
hotspotX 和hotspotY 都是指针表面左上角的偏移量,也就是点击应该发生的位置。例如,如果请求的光标表面是一个箭头,参数就表示该表面上箭头尖端的位置。
注: 相应的处理程序是onCursorSurfaceRequest
。
void keyboardFocusChanged(QWaylandSurface newFocus, QWaylandSurface oldFocus) |
当调用 setKeyboardFocus() 或WaylandQuickItem 拥有焦点且用户开始按键时,将发出该信号。
newFocus nullptr
oldFocus 为失去键盘焦点的表面;或 为没有焦点的表面。nullptr
注: 相应的处理程序是onKeyboardFocusChanged
。
方法文档
向键盘设备发送按键按下(如果pressed 是true
)或按键释放(如果pressed 是false
)事件qtKey 。
void sendTouchCancelEvent(WaylandClient client) |
向client 的触摸设备发送取消事件。
void sendTouchFrameEvent(WaylandClient client) |
向client 的触摸设备发送帧事件,以指示一系列上、下和移动触摸事件的结束。
void sendTouchPointMoved(WaylandSurface surface, int id, point position) |
为surface 上位置为position 的触摸点id 发送触摸移动事件。
注意: 完成发送触摸事件后,需要发送触摸帧事件。
警告: 此 API 不应与使用WaylandQuickItem::touchEventsEnabled 转发触摸事件结合使用,否则可能导致触摸 ID 冲突。
返回触摸运动事件的序列。
uint sendTouchPointPressed(WaylandSurface surface, int id, point position) |
为surface 上位置为position 的触摸点id 发送触摸按下事件。
注意: 发送完触摸事件后,还需要发送触摸帧事件。
警告: 此 API 不应与使用WaylandQuickItem::touchEventsEnabled 转发触摸事件结合使用,否则可能导致触摸 ID 冲突。
返回触摸下降事件的序列。
void sendTouchPointReleased(WaylandSurface surface, int id, point position) |
为surface 上位置为position 的触摸点id 发送触摸释放事件。
注意: 发送完触摸事件后,还需要发送触摸帧事件。
警告: 此 API 不应与使用WaylandQuickItem::touchEventsEnabled 转发触摸事件结合使用,否则可能导致触摸 ID 冲突。
返回触摸事件的序列。
|
通过文本输入协议发送 UCS4unicode 的按键事件。
注意: 如果客户端不支持合成器所支持的文本输入协议,该函数将无法正常工作。
此方法在 Qt 6.7 中引入。
|
通过文本输入协议发送 UCS4unicode 的按键释放事件。
注意: 如果客户端不支持合成器所支持的文本输入协议,该函数将无法正常工作。
此方法在 Qt 6.7 中引入。
© 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.