QWaylandPointer Class
QWaylandPointer 类表示一个指针设备。更多内容...
| 头文件: | #include <QWaylandPointer> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS WaylandCompositor) target_link_libraries(mytarget PRIVATE Qt6::WaylandCompositor) |
| qmake: | QT += waylandcompositor |
| 继承自: | QWaylandObject |
属性
- isButtonPressed : bool
公共函数
| 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) |
信号
| void | buttonPressedChanged() |
详细说明
该类提供对QWaylandSeat 中指针设备的访问。它对应于Wayland接口wl_pointer。
属性文档
[read-only] isButtonPressed : bool
该属性表示当前是否按下了任何鼠标按钮。
如果至少有一个鼠标按钮被按下,该值为true ;否则为false 。
访问函数:
| bool | isButtonPressed() const |
通知信号:
| void | buttonPressedChanged() |
成员函数文档
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 实际上并不合理,因为每个客户端可能存在多个指针资源。此 API 的存在仅出于兼容性考虑。
bool QWaylandPointer::isButtonPressed() const
如果当前有任何按钮被按下,则返回 true;否则返回 false。
注意: 这是 isButtonPressed 属性的getter 函数。
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)
向当前拥有鼠标焦点的视图发送一个鼠标滚轮事件,该事件包含给定的orientation 和delta 参数。
void QWaylandPointer::setOutput(QWaylandOutput *output)
将此QWaylandPointer 的输出设置为output 。
另请参阅 output()。
© 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.