QObjectPicker Class

(Qt3DRender::QObjectPicker)

The QObjectPicker class instantiates a component that can be used to interact with a QEntity by a process known as picking. More...

Header: #include <QObjectPicker>
qmake: QT += 3drender
Since: Qt 5.6
Instantiated By: ObjectPicker
Inherits: Qt3DCore::QComponent

Properties

Public Functions

QObjectPicker(QNode *parent = nullptr)
bool containsMouse() const
bool isDragEnabled() const
bool isHoverEnabled() const
bool isPressed() const

Public Slots

void setDragEnabled(bool dragEnabled)
void setHoverEnabled(bool hoverEnabled)

Signals

void clicked(Qt3DRender::QPickEvent *pick)
void containsMouseChanged(bool containsMouse)
void dragEnabledChanged(bool dragEnabled)
void entered()
void exited()
void hoverEnabledChanged(bool hoverEnabled)
void moved(Qt3DRender::QPickEvent *pick)
void pressed(Qt3DRender::QPickEvent *pick)
void pressedChanged(bool pressed)
void released(Qt3DRender::QPickEvent *pick)

Additional Inherited Members

  • 11 static public members inherited from QObject
  • 2 protected functions inherited from Qt3DCore::QNode
  • 9 protected functions inherited from QObject

Detailed Description

The QObjectPicker class instantiates a component that can be used to interact with a QEntity by a process known as picking.

The signals pressed(), released(), clicked(), moved(), entered(), and exited() are emitted when the bounding volume defined by the pickAttribute property intersects with a ray.

Pick queries are performed on mouse press and mouse release. If drag is enabled, queries also happen on each mouse move while any button is pressed. If hover is enabled, queries happen on every mouse move even if no button is pressed.

Note: Instances of this component shouldn't be shared, not respecting that condition will most likely result in undefined behavior.

See also QPickingSettings.

Property Documentation

containsMouse : const bool

Specifies if the object picker currently contains the mouse

Access functions:

bool containsMouse() const

Notifier signal:

void containsMouseChanged(bool containsMouse)

dragEnabled : bool

Specifies if drag is enabled

Access functions:

bool isDragEnabled() const
void setDragEnabled(bool dragEnabled)

Notifier signal:

void dragEnabledChanged(bool dragEnabled)

hoverEnabled : bool

Specifies if hover is enabled

Access functions:

bool isHoverEnabled() const
void setHoverEnabled(bool hoverEnabled)

Notifier signal:

void hoverEnabledChanged(bool hoverEnabled)

pressed : const bool

Specifies if the object picker is currently pressed

Access functions:

bool isPressed() const

Notifier signal:

void pressedChanged(bool pressed)

Member Function Documentation

QObjectPicker::QObjectPicker(QNode *parent = nullptr)

Default constructs an instance of QObjectPicker.

[signal] void QObjectPicker::clicked(Qt3DRender::QPickEvent *pick)

This signal is emitted when the bounding volume defined by the pickAttribute property intersects with a ray on a mouse click the QPickEvent pick contains details of the event.

bool QObjectPicker::containsMouse() const

Returns true if the object picker currently contains the mouse

Note: Getter function for property containsMouse.

[signal] void QObjectPicker::entered()

This signal is emitted when the bounding volume defined by the pickAttribute property intersects with a ray on the mouse entering the volume.

[signal] void QObjectPicker::exited()

This signal is emitted when the bounding volume defined by the pickAttribute property intersects with a ray on the ray exiting the volume.

bool QObjectPicker::isDragEnabled() const

Returns true if dragging is enabled

Note: Getter function for property dragEnabled.

bool QObjectPicker::isHoverEnabled() const

Returns true if hover enabled

Note: Getter function for property hoverEnabled.

[signal] void QObjectPicker::moved(Qt3DRender::QPickEvent *pick)

This signal is emitted when the bounding volume defined by the pickAttribute property intersects with a ray on a mouse move with a button pressed the QPickEvent pick contains details of the event.

[signal] void QObjectPicker::pressed(Qt3DRender::QPickEvent *pick)

This signal is emitted when the bounding volume defined by the pickAttribute property intersects with a ray on a mouse press the QPickEvent pick contains details of the event.

[signal] void QObjectPicker::released(Qt3DRender::QPickEvent *pick)

This signal is emitted when the bounding volume defined by the pickAttribute property intersects with a ray on a mouse release the QPickEvent pick contains details of the event.

[slot] void QObjectPicker::setDragEnabled(bool dragEnabled)

Sets the dragEnabled Property to dragEnabled

Note: Setter function for property dragEnabled.

See also isDragEnabled().

[slot] void QObjectPicker::setHoverEnabled(bool hoverEnabled)

Sets the hoverEnabled Property to hoverEnabled

Note: Setter function for property hoverEnabled.

See also isHoverEnabled().

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