QEntity Class

class Qt3DCore ::QEntity

Qt3DCore::QEntity Qt3DCore::QNode subclass that can aggregate several Qt3DCore::QComponent instances that will specify its behavior. 更多...

头: #include <QEntity>
qmake: QT += 3dcore
Since: Qt 5.5
实例化: Entity
继承: Qt3DCore::QNode
继承者:

Qt3DExtras::QAbstractCameraController , Qt3DExtras::QSkyboxEntity , Qt3DExtras::QText2DEntity ,和 Qt3DRender::QCamera

该类在 Qt 5.5 引入。

公共函数

QEntity (Qt3DCore::QNode * parent = nullptr)
void addComponent (Qt3DCore::QComponent * comp )
Qt3DCore::QComponentVector components () const
QVector<T *> componentsOfType () const
Qt3DCore::QEntity * parentEntity () const
void removeComponent (Qt3DCore::QComponent * comp )
typedef QComponentVector

详细描述

By itself a Qt3DCore::QEntity is an empty shell. The behavior of a Qt3DCore::QEntity object is defined by the Qt3DCore::QComponent objects it references. Each Qt3D backend aspect will be able to interpret and process an Entity by recognizing which components it is made up of. One aspect may decide to only process entities composed of a single Qt3DCore::QTransform component whilst another may focus on Qt3DInput::QMouseHandler .

另请参阅 Qt3DCore::QComponent and Qt3DCore::QTransform .

成员函数文档编制

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

构造新的 Qt3DCore::QEntity 实例与 parent 作为父级。

void QEntity:: addComponent ( Qt3DCore::QComponent * comp )

Adds a new reference to the component comp .

注意: Qt3DCore::QComponent has no parent, the Qt3DCore::QEntity will set itself as its parent thereby taking ownership of the component.

Qt3DCore::QComponentVector QEntity:: components () const

Returns the list of Qt3DCore::QComponent instances the entity is referencing.

template <typename T> QVector < T *> QEntity:: componentsOfType () const

Returns all the components added to this entity that can be cast to type T or an empty vector if there are no such components.

Qt3DCore::QEntity *QEntity:: parentEntity () const

Returns the parent Qt3DCore::QEntity instance of this entity. If the immediate parent isn't a Qt3DCore::QEntity , this function traverses up the scene hierarchy until a parent Qt3DCore::QEntity is found. If no Qt3DCore::QEntity parent can be found, returns null.

void QEntity:: removeComponent ( Qt3DCore::QComponent * comp )

Removes the reference to comp .

相关非成员

typedef QComponentVector

List of QComponent pointers.