QNode Class

(Qt3D::QNode)

Qt3D::QNode is the base class of all Qt3D node classes used to build a Qt3D scene. More...

Header: #include <QNode>
qmake: QT += 3dcore
Since: Qt 5.5
Inherits:
Inherited By:

Qt3D::QComponent, Qt3D::QEntity, and Qt3D::QKeyboardController

Public Functions

QNode(QNode * parent = 0)
~QNode()
bool blockNotifications(bool block)
const QNodeId id() const
bool notificationsBlocked() const
QNode * parentNode() const

Protected Functions

virtual void copy(const QNode * ref)
bool event(QEvent * e)
QSceneInterface * scene() const
virtual void sceneChangeEvent(const QSceneChangePtr & change)

Static Protected Members

QNode * clone(QNode * node)

Detailed Description

Qt3D::QNode is the base class of all Qt3D node classes used to build a Qt3D scene.

The owernship of Qt3D::QNode is determined by the QObject parent/child relationship between nodes. By itself a Qt3D::QNode has no visual appearance and no particular meaning, it is there as a way of building a node based tree structure.

Each Qt3D::QNode instance has a unique id that allows it to be recognizable from other instances.

When properties are defined on a Qt3D::QNode subclass, their NOTIFY signal will automatically generate notifications that the Qt3D backend aspects will receive.

See also Qt3D::QEntity and Qt3D::QComponent.

Member Function Documentation

QNode::QNode(QNode * parent = 0)

Creates a new Qt3D::QNode instance with parent parent.

QNode::~QNode()

bool QNode::blockNotifications(bool block)

If block is true, property change notifications sent by this object to aspects are blocked. If block is false, no such blocking will occur.

The return value is the previous value of notificationsBlocked().

Note that the other notification types will be sent even if the notifications for this object have been blocked.

See also notificationsBlocked().

[static protected] QNode * QNode::clone(QNode * node)

Returns a clone of node. All the children of node are cloned as well.

Note: This is the only way to create two nodes with the same id.

[virtual protected] void QNode::copy(const QNode * ref)

Copies all the attributes from ref to the current Qt3D::QNode instance.

Note: When subclassing Qt3D::QNode you should reimplement this method and always call the copy method on the base class. This will ensure that when cloned, the Qt3D::QNode is properly initialized.

[protected] bool QNode::event(QEvent * e)

const QNodeId QNode::id() const

Returns the id that uniquely identifies the Qt3D::QNode instance.

bool QNode::notificationsBlocked() const

Returns true if aspect notifications are blocked; otherwise returns false. Notifications are not blocked by default.

See also blockNotifications().

QNode * QNode::parentNode() const

Returns the immediate Qt3D::QNode parent, null if the node has no parent.

[protected] QSceneInterface * QNode::scene() const

Returns a pointer to the Qt3D::QNode instance's scene.

[virtual protected] void QNode::sceneChangeEvent(const QSceneChangePtr & change)

Called when one or more backend aspects sends a notification change to the current Qt3D::QNode instance.

Note: This method should be reimplemented in your subclasses to properly handle the change.