Qt3DRender::QScreenRayCaster Class | Qt 3D | Qt 6.11.0
Description: Performe ray casting test based on screen coordinates.

- Qt 6.11
- Qt 3D
- C++ Classes
- Qt3DRender (Deprecated)
- QScreenRayCaster
- Qt 6.11.0 Reference Documentation

# Qt3DRender::QScreenRayCaster Class

class Qt3DRender::QScreenRayCaster

Performe ray casting test based on screen coordinates. More...

Header: | `#include <QScreenRayCaster>`
CMake: | `find_package(Qt6 REQUIRED COMPONENTS 3drender)` `target_link_libraries(mytarget PRIVATE Qt6::3drender)`
qmake: | `QT += 3drender`
In QML: | ScreenRayCaster
Inherits: | Qt3DRender::QAbstractRayCaster
Status: | Deprecated

- List of all members, including inherited members

## Properties

- position : QPoint

## Public Functions

QPoint | position() const

## Public Slots

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

## Signals

void | positionChanged(const QPoint &position)

## Detailed Description

QScreenRayCaster can be used to perform ray casting tests by specifying coordinates in screen space, which will be used to construct an actual 3D ray between the near and far planes.

See also QRayCaster and QNoPicking.

## Property Documentation

### position : QPoint

Holds the screen space position used to compute the actual 3D ray for intersection tests.

Note: the coordinates will be used for every available render surface as long as they are in the valid range.

Access functions:

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

Notifier signal:

void | positionChanged(const QPoint &position)

## Member Function Documentation

### `[slot]` void QScreenRayCaster::trigger()

Convenience method to enable the component and trigger tests using the current coordinate value.

Note: This slot is overloaded. To connect to this slot:

     // 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(); });

For more examples and approaches, see connecting to overloaded slots.

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

Convenience method to set the coordinate value position and enable the component to trigger tests.

Note: This slot is overloaded. To connect to this slot:

     // 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); });

For more examples and approaches, see connecting to overloaded slots.