QNode Class

( Qt3DCore::QNode )

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

头: #include <QNode>
qmake: QT += 3dcore
Since: Qt 5.5
继承: QObject
继承者: Qt3DAnimation::QAbstractAnimationClip , Qt3DAnimation::QAbstractClipBlendNode , Qt3DAnimation::QChannelMapper , Qt3DCore::QAbstractSkeleton , Qt3DCore::QComponent , Qt3DCore::QEntity , Qt3DCore::QJoint , 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 , Qt3DRender::QPickingSettings , Qt3DRender::QRenderPass , Qt3DRender::QRenderState , Qt3DRender::QRenderTargetOutput , Qt3DRender::QShaderProgram , Qt3DRender::QShaderProgramBuilder , Qt3DRender::QTechnique ,和 Qt3DRender::Quick::QScene2D

公共类型

enum PropertyTrackingMode { TrackFinalValues, DontTrackValues, TrackAllValues }

特性

公共函数

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
QNodeCommand::CommandId sendCommand (const QString & name , const QVariant & data = QVariant(), QNodeCommand::CommandId replyTo = QNodeCommand::CommandId())
void sendReply (const Qt3DCore::QNodeCommandPtr & 命令 )
void setPropertyTracking (const QString & propertyName , Qt3DCore::QNode::PropertyTrackingMode trackMode )

公共槽

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

信号

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

静态公共成员

const QMetaObject staticMetaObject

保护函数

void notifyObservers (const Qt3DCore::QSceneChangePtr & change )
virtual void sceneChangeEvent (const Qt3DCore::QSceneChangePtr & change )
typedef QNodePtr
typedef QNodeVector
Qt3DCore::QNodeId qIdForNode (Qt3DCore::QNode * node )
Qt3DCore::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 实例。

每个 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 .

成员类型文档编制

enum QNode:: PropertyTrackingMode

Indicates how a QNode listens for property updates.

常量 描述
Qt3DCore::QNode::TrackFinalValues 0 Tracks final values
Qt3DCore::QNode::DontTrackValues 1 Does not track values
Qt3DCore::QNode::TrackAllValues 2 Tracks all values

特性文档编制

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

访问函数:

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

通知程序信号:

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

enabled : bool

保持 QNode enabled flag. By default a QNode is always enabled.

注意: 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 )

通知程序信号:

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.

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

访问函数:

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

通知程序信号:

void parentChanged (QObject * parent )

成员函数文档编制

QNode:: QNode ( Qt3DCore::QNode * parent = nullptr)

创建新的 QNode instance with parent parent .

注意: 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 )

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

返回值是先前值的 notificationsBlocked ().

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

另请参阅 notificationsBlocked ().

Qt3DCore::QNodeVector QNode:: childNodes () const

Returns a list filled with the QNode children of the current QNode 实例。

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.

注意: getter 函数对于特性 defaultPropertyTrackingMode .

另请参阅 setDefaultPropertyTrackingMode ().

Qt3DCore::QNodeId QNode:: id () const

Returns the id that uniquely identifies the QNode 实例。

[signal] void QNode:: nodeDestroyed ()

Emitted when the node is destroyed.

bool QNode:: notificationsBlocked () const

返回 true if aspect notifications are blocked; otherwise returns false . By default, notifications are not blocked.

另请参阅 blockNotifications ().

[protected] void QNode:: notifyObservers (const Qt3DCore::QSceneChangePtr & change )

发送 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.

Qt3DCore::QNode::PropertyTrackingMode QNode:: propertyTracking (const QString & propertyName ) const

Returns the tracking mode of propertyName .

另请参阅 setPropertyTracking ().

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

Called when one or more backend aspects sends a notification change to the current Qt3DCore::QNode 实例。

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

QNodeCommand::CommandId QNode:: sendCommand (const QString & name , const QVariant & data = QVariant(), QNodeCommand::CommandId replyTo = QNodeCommand::CommandId())

Sends a command message to the backend node

创建 QNodeCommand message and dispatches it to the backend node. The command is given and a name 和一些 data which can be used in the backend node to perform various operations. This returns a CommandId which can be used to identify the initial command when receiving a message in reply. If the command message is to be sent in reply to another command, replyTo contains the id of that command.

另请参阅 QNodeCommand and QNode::sendReply .

void QNode:: sendReply (const Qt3DCore::QNodeCommandPtr & 命令 )

发送 命令 back to the backend node.

Assumes the command is to be to sent back in reply to itself to the backend node.

另请参阅 QNodeCommand and QNode::sendCommand .

void QNode:: setPropertyTracking (const QString & propertyName , Qt3DCore::QNode::PropertyTrackingMode trackMode )

Sets the property tracking for propertyName and trackMode .

另请参阅 propertyTracking ().

相关非成员

typedef Qt3DCore:: QNodePtr

共享指针为 QNode .

typedef Qt3DCore:: QNodeVector

List of QNode pointers.

Qt3DCore::QNodeId Qt3DCore:: qIdForNode ( Qt3DCore::QNode * node )

Returns node id for node .

Qt3DCore::QNodeIdVector Qt3DCore:: qIdsForNodes (const T & nodes )

Returns vector of node ids for nodes .