Qt 5.6 | Qt 3D | C++ Classes | QEntity

Qt 5.6.3 Reference Documentation

# QEntity Class

(Qt3DCore::QEntity)

Qt3DCore::QEntity is a Qt3DCore::QNode subclass that can aggregate several Qt3DCore::QComponent instances that will specify its behavior. More...

Header: | #include <QEntity>
qmake: | QT += 3dcore
Since: | Qt 5.5
Inherits: | QNode
Inherited By: | Qt3DRender::QSkyboxEntity

- List of all members, including inherited members

## Public Functions

| QEntity(QNode *parent = Q_NULLPTR)
virtual | ~QEntity()
void | addComponent(QComponent *comp)
QComponentList | components() const
QEntity * | parentEntity() const
void | removeAllComponents()
void | removeComponent(QComponent *comp)

- 6 public functions inherited from Qt3DCore::QNode

## Reimplemented Protected Functions

virtual void | copy(const QNode *ref)

- 3 protected functions inherited from Qt3DCore::QNode

## Related Non-Members

typedef | QComponentList

### Additional Inherited Members

- 2 properties inherited from Qt3DCore::QNode
- 2 public slots inherited from Qt3DCore::QNode
- 2 signals inherited from Qt3DCore::QNode
- 3 protected functions inherited from Qt3DCore::QNode
- 1 static protected member inherited from Qt3DCore::QNode

## Detailed Description

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

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 Qt3DCore::QMouseInput.

See also Qt3DCore::QComponent and Qt3DCore::QTransform.

## Member Function Documentation

### QEntity::QEntity(QNode *parent = Q_NULLPTR)

Constructs a new Qt3DCore::QEntity instance with parent as parent.

### `[virtual]` QEntity::~QEntity()

Destroys the instance of QEntity. The destructor is virtual.

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

Adds a new reference to the component comp.

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

### QComponentList QEntity::components() const

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

### `[virtual protected]` void QEntity::copy(const QNode *ref)

Reimplemented from QNode::copy().

Copies all the properties and components of the Qt3DCore::QEntity ref to the current instance.

### 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::removeAllComponents()

Remove all references to the components.

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

Removes the reference to comp.

## Related Non-Members

### typedef Qt3DCore::QComponentList

List of QComponent pointers.