QNode Class
(Qt3DCore::QNode)QNode is the base class of all Qt3D node classes used to build a Qt3D scene. 更多...
公有类型
enum | PropertyTrackingMode { TrackFinalValues, DontTrackValues, TrackAllValues } |
属性
- defaultPropertyTrackingMode : PropertyTrackingMode
- enabled : bool
- parent : Qt3DCore::QNode *
- 1 个属性继承自 QObject
公有函数
QNode(QNode *parent = nullptr) | |
bool | blockNotifications(bool block) |
QNodeVector | childNodes() const |
void | clearPropertyTracking(const QString &propertyName) |
void | clearPropertyTrackings() |
PropertyTrackingMode | defaultPropertyTrackingMode() const |
QNodeId | id() const |
bool | isEnabled() const |
bool | notificationsBlocked() const |
QNode * | parentNode() const |
PropertyTrackingMode | propertyTracking(const QString &propertyName) const |
void | setPropertyTracking(const QString &propertyName, PropertyTrackingMode trackMode) |
- 32 个公有函数继承自 QObject
公有槽函数
void | setDefaultPropertyTrackingMode(PropertyTrackingMode mode) |
void | setEnabled(bool isEnabled) |
void | setParent(QNode *parent) |
- 1 个公有槽函数继承自 QObject
信号
void | defaultPropertyTrackingModeChanged(PropertyTrackingMode mode) |
void | enabledChanged(bool enabled) |
void | nodeDestroyed() |
void | parentChanged(QObject *parent) |
- 2 个信号继承自 QObject
受保护的函数
void | notifyObservers(const QSceneChangePtr &change) |
virtual void | sceneChangeEvent(const QSceneChangePtr &change) |
- 9 个受保护的函数继承自 QObject
相关非成员
typedef | QNodePtr |
typedef | QNodeVector |
QNodeId | qIdForNode(QNode *node) |
QNodeIdVector | qIdsForNodes(const T &nodes) |
其他继承的成员
详细描述
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.
参见 QEntity and QComponent.
属性
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
访问函数:
PropertyTrackingMode | defaultPropertyTrackingMode() const |
void | setDefaultPropertyTrackingMode(PropertyTrackingMode mode) |
Notifier signal:
void | defaultPropertyTrackingModeChanged(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.
访问函数:
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.
访问函数:
QNode * | parentNode() const |
void | setParent(QNode *parent) |
Notifier signal:
void | parentChanged(QObject *parent) |
成员函数
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.
参见 setParent().
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.
参见 notificationsBlocked().
QNodeVector QNode::childNodes() const
Returns a list filled with the QNode children of the current QNode instance.
void QNode::clearPropertyTracking(const QString &propertyName)
void QNode::clearPropertyTrackings()
QNodeId QNode::id() const
Returns the id that uniquely identifies the QNode instance.
[signal]
void QNode::nodeDestroyed()
emitted when the node is destroyed.
bool QNode::notificationsBlocked() const
Returns true
if aspect notifications are blocked; otherwise returns false
. By default, notifications are not blocked.
参见 blockNotifications().
[protected]
void QNode::notifyObservers(const QSceneChangePtr &change)
Sends the change QSceneChangePtr to any QBackendNodes in the registered aspects that correspond to this QNode.
For the common case of a QObject property change, QNode handles this for you automatically by sending a QPropertyUpdatedChange event to the backend nodes. You only need to call this function if you wish to send a specific type of change in place of the automatic handling.
PropertyTrackingMode QNode::propertyTracking(const QString &propertyName) const
参见 setPropertyTracking().
[virtual protected]
void QNode::sceneChangeEvent(const QSceneChangePtr &change)
Called when one or more backend aspects sends a notification change to the current Qt3DCore::QNode instance.
Note: This method should be reimplemented in your subclasses to properly handle the change.
void QNode::setPropertyTracking(const QString &propertyName, PropertyTrackingMode trackMode)
参见 propertyTracking().