QNode Class
(Qt3DCore::QNode)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: | QObject |
Inherited By: | Qt3DCore::QComponent, Qt3DCore::QEntity, Qt3DInput::QAbstractActionInput, Qt3DInput::QAbstractAxisInput, Qt3DInput::QAbstractPhysicalDevice, Qt3DInput::QAction, Qt3DInput::QAxis, Qt3DInput::QAxisSetting, Qt3DRender::QAbstractTexture, Qt3DRender::QAbstractTextureImage, Qt3DRender::QAttribute, Qt3DRender::QBuffer, Qt3DRender::QEffect, Qt3DRender::QFilterKey, Qt3DRender::QFrameGraphNode, Qt3DRender::QGeometry, Qt3DRender::QParameter, and Qt3DRender::QRenderPass |
Properties
- 1 property inherited from QObject
Public Functions
QNode(QNode *parent = nullptr) | |
virtual | ~QNode() |
bool | blockNotifications(bool block) |
QNodeVector | childNodes() const |
QNodeId | id() const |
bool | isEnabled() const |
bool | notificationsBlocked() const |
QNode * | parentNode() const |
- 31 public functions inherited from QObject
Public Slots
void | setEnabled(bool isEnabled) |
void | setParent(QNode *parent) |
- 1 public slot inherited from QObject
Signals
void | enabledChanged(bool enabled) |
void | nodeDestroyed() |
void | parentChanged(QObject *parent) |
- 2 signals inherited from QObject
Protected Functions
void | notifyObservers(const QSceneChangePtr &change) |
virtual void | sceneChangeEvent(const QSceneChangePtr &change) |
- 9 protected functions inherited from QObject
Related Non-Members
typedef | QNodePtr |
typedef | QNodeVector |
QNodeId | qIdForNode(QNode *node) |
QNodeIdVector | qIdsForNodes(const T &nodes) |
Additional Inherited Members
- 1 public variable inherited from QObject
- 10 static public members inherited from QObject
- 2 protected variables inherited from QObject
Detailed Description
QNode is the base class of all Qt3D node classes used to build a Qt3D scene.
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.
When subclassing QNode, make sure to call QNode::cleanup() from your subclass's destructor to ensure proper notification to backend aspects. Faiure to do so will result in crashes when one of your QNode subclass instance is eventually destroyed.
See also QEntity and QComponent.
Property Documentation
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:
QNode * | parentNode() const |
void | setParent(QNode *parent) |
Notifier signal:
void | parentChanged(QObject *parent) |
Member Function Documentation
QNode::QNode(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().
[virtual]
QNode::~QNode()
Destroys the instance of QNode. The destructor is virtual.
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().
QNodeVector QNode::childNodes() const
Returns a list filled with the QNode children of the current QNode instance.
QNodeId QNode::id() const
Returns the id that uniquely identifies the QNode instance.
[signal]
void QNode::nodeDestroyed()
bool QNode::notificationsBlocked() const
Returns true
if aspect notifications are blocked; otherwise returns false
. By default, notifications are not blocked.
See also blockNotifications().