QNode Class

class Qt3DCore::QNode

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

This class was introduced in Qt 5.5.

Public Types

enum PropertyTrackingMode { TrackFinalValues, DontTrackValues, TrackAllValues }

Properties

Public Functions

Qt3DCore::QNode::PropertyTrackingMode defaultPropertyTrackingMode() const
bool isEnabled() const
Qt3DCore::QNode *parentNode() const

Public Slots

void setDefaultPropertyTrackingMode(Qt3DCore::QNode::PropertyTrackingMode mode)
void setEnabled(bool isEnabled)
void setParent(Qt3DCore::QNode *parent)

Signals

void defaultPropertyTrackingModeChanged(Qt3DCore::QNode::PropertyTrackingMode mode)
void enabledChanged(bool enabled)
void parentChanged(QObject *parent)
typedef QNodePtr
typedef QNodeVector

Detailed Description

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

The parent of a QNode instance can only be another QNode instance.

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

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

See also QEntity and QComponent.

Member Type Documentation

enum QNode::PropertyTrackingMode

Indicates how a QNode listens for property updates.

ConstantValueDescription
Qt3DCore::QNode::TrackFinalValues0Tracks final values
Qt3DCore::QNode::DontTrackValues1Does not track values
Qt3DCore::QNode::TrackAllValues2Tracks all values

Property Documentation

defaultPropertyTrackingMode : PropertyTrackingMode

Holds the default property tracking mode which determines whether a QNode should be listening for property updates. This only applies to properties which haven't been overridden by a call to setPropertyTracking.

By default it is set to QNode::TrackFinalValues

Access functions:

Qt3DCore::QNode::PropertyTrackingMode defaultPropertyTrackingMode() const
void setDefaultPropertyTrackingMode(Qt3DCore::QNode::PropertyTrackingMode mode)

Notifier signal:

void defaultPropertyTrackingModeChanged(Qt3DCore::QNode::PropertyTrackingMode mode)

enabled : bool

Holds the QNode enabled flag. By default a QNode is always enabled.

Note: the interpretation of what enabled means is aspect-dependent. Even if enabled is set to false, some aspects may still consider the node in some manner. This is documented on a class by class basis.

Access functions:

bool isEnabled() const
void setEnabled(bool isEnabled)

Notifier signal:

void enabledChanged(bool enabled)

parent : Qt3DCore::QNode*

Holds the immediate QNode parent, or null if the node has no parent.

Setting the parent will notify the backend aspects about current QNode instance's parent change.

Note: if parent happens to be null, this will actually notify that the current QNode instance was removed from the scene.

Access functions:

Qt3DCore::QNode *parentNode() const
void setParent(Qt3DCore::QNode *parent)

Notifier signal:

void parentChanged(QObject *parent)

Related Non-Members

typedef QNodePtr

A shared pointer for QNode.

typedef QNodeVector

List of QNode pointers.