在本页

QWaylandKeyboard Class

QWaylandKeyboard 类表示键盘设备。更多

Header: #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)

Notifier 信号:

void repeatDelayChanged(quint32 repeatDelay)

repeatRate : quint32

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

访问功能:

quint32 repeatRate() const
void setRepeatRate(quint32 rate)

Notifier 信号:

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.