本页内容

Qt3DRender::QScreenRayCaster Class

class Qt3DRender::QScreenRayCaster

根据屏幕坐标执行光线投射测试。更多...

标题: #include <qscreenraycaster.h>
CMake: find_package(Qt6 REQUIRED COMPONENTS 3drender)
target_link_libraries(mytarget PRIVATE Qt6::3drender)
qmake: QT += 3drender
在 QML 中: ScreenRayCaster
继承自: Qt3DRender::QAbstractRayCaster
状态: 已弃用

该类已弃用。我们强烈建议不要在新代码中使用它。

属性

公共函数

QPoint position() const

公共槽位

void setPosition(const QPoint &position)
void trigger()
void trigger(const QPoint &position)

信号

void positionChanged(const QPoint &position)

详细说明

QScreenRayCaster 可通过指定屏幕空间中的坐标来执行光线投射测试,这些坐标将用于在近平面和远平面之间构建实际的 3D 光线。

另请参阅 QRayCaster 和QNoPicking 。

属性文档

position : QPoint

存储用于计算实际 3D 光线以进行相交测试的屏幕空间位置。

注意:只要坐标在有效范围内,它们将用于所有可用的渲染表面。

访问函数:

QPoint position() const
void setPosition(const QPoint &position)

通知信号:

void positionChanged(const QPoint &position)

成员函数文档

[slot] void QScreenRayCaster::trigger()

一种便捷的方法,用于启用该组件并使用当前坐标值触发测试。

注意:此 插槽已被重载。要连接到此插槽:

// Connect using qOverload:
connect(sender, &SenderClass::signal,
        screenRayCaster, qOverload<>(&QScreenRayCaster::trigger));

// Or using a lambda as wrapper:
connect(sender, &SenderClass::signal,
        screenRayCaster, [receiver = screenRayCaster]() { receiver->trigger(); });
有关更多示例和方法,请参阅“连接到重载插槽”。

[slot] void QScreenRayCaster::trigger(const QPoint &position)

一种便捷的方法,用于设置坐标值position ,并使组件能够触发测试。

注意:此 插槽为重载插槽。要连接到此插槽:

// Connect using qOverload:
connect(sender, &SenderClass::signal,
        screenRayCaster, qOverload(&QScreenRayCaster::trigger));

// Or using a lambda as wrapper:
connect(sender, &SenderClass::signal,
        screenRayCaster, [receiver = screenRayCaster](const QPoint &position) { receiver->trigger(position); });
有关更多示例和方法,请参阅“连接到重载的插槽”。

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