QWaylandPointer Class

QWaylandPointer 类代表一个指针设备。更多

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

公共函数

QWaylandPointer(QWaylandSeat *seat, QObject *parent = nullptr)
QWaylandCompositor *compositor() const
QPointF currentLocalPosition() const
QPointF currentSpacePosition() const
wl_resource *focusResource() const
bool isButtonPressed() const
QWaylandView *mouseFocus() const
QWaylandOutput *output() const
QWaylandSeat *seat() const
virtual void sendMouseMoveEvent(QWaylandView *view, const QPointF &localPos, const QPointF &outputSpacePos)
virtual uint sendMousePressEvent(Qt::MouseButton button)
virtual uint sendMouseReleaseEvent(Qt::MouseButton button)
virtual void sendMouseWheelEvent(Qt::Orientation orientation, int delta)
void setOutput(QWaylandOutput *output)

信号

详细说明

该类可访问QWaylandSeat 中的指针设备。它与 Wayland 接口 wl_pointer 相对应。

成员函数文档

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

为给定的seat 并使用给定的parent 构建一个 QWaylandPointer。

QWaylandCompositor *QWaylandPointer::compositor() const

返回QWaylandPointer 的合成器。

QPointF QWaylandPointer::currentLocalPosition() const

以曲面坐标返回QWaylandPointer 当前的本地位置。

QPointF QWaylandPointer::currentSpacePosition() const

返回QWaylandPointer 的当前输出空间位置。

wl_resource *QWaylandPointer::focusResource() const

返回QWaylandPointer 的 Wayland 资源。

由于每个客户端可能有很多指针资源,因此该 API 实际上并无意义。

bool QWaylandPointer::isButtonPressed() const

如果当前有任何按钮被按下,则返回 true。否则返回 false。

注: 属性 isButtonPressed 的获取函数。

QWaylandView *QWaylandPointer::mouseFocus() const

返回当前鼠标焦点所在的视图。

QWaylandOutput *QWaylandPointer::output() const

返回QWaylandPointer 的输出结果。

另请参阅 setOutput() 。

QWaylandSeat *QWaylandPointer::seat() const

返回QWaylandPointer 的输入设备。

[virtual] void QWaylandPointer::sendMouseMoveEvent(QWaylandView *view, const QPointF &localPos, const QPointF &outputSpacePos)

将当前鼠标焦点设置为view ,并向其发送一个鼠标移动事件,其中包含以曲面坐标表示的本地位置localPos 和输出空间位置outputSpacePos

[virtual] uint QWaylandPointer::sendMousePressEvent(Qt::MouseButton button)

向当前持有鼠标焦点的视图发送鼠标按下事件button

返回按下事件的序列号。

[virtual] uint QWaylandPointer::sendMouseReleaseEvent(Qt::MouseButton button)

向当前持有鼠标焦点的视图发送鼠标释放事件button

返回释放事件的序列号。

[virtual] void QWaylandPointer::sendMouseWheelEvent(Qt::Orientation orientation, int delta)

向当前持有鼠标焦点的视图发送带有给定orientationdelta 的鼠标滚轮事件。

void QWaylandPointer::setOutput(QWaylandOutput *output)

QWaylandPointer 的输出设置为output

另请参阅 output() 。

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