本页内容

QWaylandKeyboard Class

QWaylandKeyboard 类表示一个键盘设备。更多内容...

头文件: #include <QWaylandKeyboard>
CMake: find_package(Qt6 REQUIRED COMPONENTS WaylandCompositor)
target_link_libraries(mytarget PRIVATE Qt6::WaylandCompositor)
qmake: QT += waylandcompositor
继承自: QWaylandObject

属性

公共函数

QWaylandKeyboard(QWaylandSeat *seat, QObject *parent = nullptr)
QWaylandCompositor *compositor() const
QWaylandSurface *focus() const
QWaylandClient *focusClient() const
quint32 repeatDelay() const
quint32 repeatRate() const
QWaylandSeat *seat() const
virtual void sendKeyModifiers(QWaylandClient *client, uint32_t serial)
virtual void sendKeyPressEvent(uint code)
virtual void sendKeyReleaseEvent(uint code)
virtual void setFocus(QWaylandSurface *surface)
void setRepeatDelay(quint32 delay)
void setRepeatRate(quint32 rate)

信号

void repeatDelayChanged(quint32 repeatDelay)
void repeatRateChanged(quint32 repeatRate)

详细说明

该类提供对QWaylandSeat 中键盘设备的访问。它对应于Wayland接口wl_keyboard。

属性文档

repeatDelay : quint32

该属性表示键重复事件开始前的延迟时间,单位为毫秒。

访问函数:

quint32 repeatDelay() const
void setRepeatDelay(quint32 delay)

通知信号:

void repeatDelayChanged(quint32 repeatDelay)

repeatRate : quint32

该属性表示键盘生成按键重复事件的速率,单位为每秒字符数。

访问函数:

quint32 repeatRate() const
void setRepeatRate(quint32 rate)

通知信号:

void repeatRateChanged(quint32 repeatRate)

成员函数文档

QWaylandKeyboard::QWaylandKeyboard(QWaylandSeat *seat, QObject *parent = nullptr)

根据给定的seat 和parent ,创建一个QWaylandKeyboard。

QWaylandCompositor *QWaylandKeyboard::compositor() const

返回此QWaylandKeyboard 的合成器。

QWaylandSurface *QWaylandKeyboard::focus() const

返回当前处于焦点状态的表面。

另请参阅 setFocus()。

QWaylandClient *QWaylandKeyboard::focusClient() const

返回当前拥有键盘焦点的客户端。

quint32 QWaylandKeyboard::repeatDelay() const

返回当前的重复延迟。

注意: 这是 repeatDelay 属性的获取函数 。

另请参阅 setRepeatDelay()。

quint32 QWaylandKeyboard::repeatRate() const

返回当前的重复速率。

注意: 这是 repeatRate 属性的获取器 函数。

另请参阅 setRepeatRate()。

QWaylandSeat *QWaylandKeyboard::seat() const

返回此QWaylandKeyboard 的座位信息。

[virtual] void QWaylandKeyboard::sendKeyModifiers(QWaylandClient *client, uint32_t serial)

将当前的键修饰符连同给定的serial 一起发送到client 。

[virtual] void QWaylandKeyboard::sendKeyPressEvent(uint code)

向当前键盘焦点发送一个键按事件,键值为code 。

[virtual] void QWaylandKeyboard::sendKeyReleaseEvent(uint code)

向当前拥有键盘焦点的窗口发送一个键释放事件,键值为code 。

[virtual] void QWaylandKeyboard::setFocus(QWaylandSurface *surface)

将当前焦点设置为surface 。

另请参阅 focus()。

void QWaylandKeyboard::setRepeatDelay(quint32 delay)

将重复延迟设置为delay 。

注意: 这是属性repeatDelay 的设置 函数。

另请参阅 repeatDelay()。

void QWaylandKeyboard::setRepeatRate(quint32 rate)

将重复速率设置为rate 。

注意: 这是属性repeatRate 的设置 函数。

另请参阅 repeatRate()。

© 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.