QNode Class
class Qt3DCore::QNodeQNode 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
- defaultPropertyTrackingMode : PropertyTrackingMode
- enabled : bool
- parent : Qt3DCore::QNode*
Public Functions
QNode(Qt3DCore::QNode *parent = nullptr) | |
bool | blockNotifications(bool block) |
Qt3DCore::QNodeVector | childNodes() const |
void | clearPropertyTracking(const QString &propertyName) |
void | clearPropertyTrackings() |
Qt3DCore::QNode::PropertyTrackingMode | defaultPropertyTrackingMode() const |
Qt3DCore::QNodeId | id() const |
bool | isEnabled() const |
bool | notificationsBlocked() const |
Qt3DCore::QNode * | parentNode() const |
Qt3DCore::QNode::PropertyTrackingMode | propertyTracking(const QString &propertyName) const |
void | setPropertyTracking(const QString &propertyName, Qt3DCore::QNode::PropertyTrackingMode trackMode) |
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 | nodeDestroyed() |
void | parentChanged(QObject *parent) |
Protected Functions
void | notifyObservers(const Qt3DCore::QSceneChangePtr &change) |
Related Non-Members
typedef | QNodePtr |
typedef | QNodeVector |
Qt3DCore::QNodeId | qIdForNode(Qt3DCore::QNode *node) |
Qt3DCore::QNodeIdVector | qIdsForNodes(const T &nodes) |
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.
Constant | Value | Description |
---|---|---|
Qt3DCore::QNode::TrackFinalValues | 0 | Tracks final values |
Qt3DCore::QNode::DontTrackValues | 1 | Does not track values |
Qt3DCore::QNode::TrackAllValues | 2 | Tracks 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) |
Member Function Documentation
QNode::QNode(Qt3DCore::QNode *parent = nullptr)
Creates a new QNode instance with parent parent.
Note: The backend aspects will be notified that a QNode instance is part of the scene only if it has a parent; unless this is the root node of the Qt3D scene.
See also setParent().
[signal]
void QNode::nodeDestroyed()
Emitted when the node is destroyed.
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().
Qt3DCore::QNodeVector QNode::childNodes() const
Returns a list filled with the QNode children of the current QNode instance.
void QNode::clearPropertyTracking(const QString &propertyName)
Clears the tracking property called propertyName.
void QNode::clearPropertyTrackings()
Erases all values that have been saved by the property tracking.
Qt3DCore::QNode::PropertyTrackingMode QNode::defaultPropertyTrackingMode() const
Returns the default property tracking mode which determines whether a QNode should be listening for property updates.
Note: Getter function for property defaultPropertyTrackingMode.
See also setDefaultPropertyTrackingMode().
Qt3DCore::QNodeId QNode::id() const
Returns the id that uniquely identifies the QNode instance.
bool QNode::notificationsBlocked() const
Returns true
if aspect notifications are blocked; otherwise returns false
. By default, notifications are not blocked.
See also blockNotifications().
[protected]
void QNode::notifyObservers(const Qt3DCore::QSceneChangePtr &change)
Sends the change QSceneChangePtr to any QBackendNodes in the registered aspects that correspond to this QNode.
You only need to call this function if you wish to send a specific type of change in place of the automatic handling.
Note: as of Qt 5.14, change messages are deprecated and should not be used, in particular for properties.
Qt3DCore::QNode::PropertyTrackingMode QNode::propertyTracking(const QString &propertyName) const
Returns the tracking mode of propertyName.
See also setPropertyTracking().
void QNode::setPropertyTracking(const QString &propertyName, Qt3DCore::QNode::PropertyTrackingMode trackMode)
Sets the property tracking for propertyName and trackMode.
See also propertyTracking().
Related Non-Members
typedef QNodePtr
A shared pointer for QNode.
typedef QNodeVector
List of QNode pointers.
Qt3DCore::QNodeId qIdForNode(Qt3DCore::QNode *node)
Returns node id for node.
template <typename T> Qt3DCore::QNodeIdVector qIdsForNodes(const T &nodes)
Returns vector of node ids for nodes.
© 2024 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.