- Qt 5.5
- Qt3D Module
- C++ Classes
- QEntity
- Qt 5.5.1 Reference Documentation

# QEntity Class

(Qt3D::QEntity)

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

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

- List of all members, including inherited members

## Public Functions

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

- 6 public functions inherited from Qt3D::QNode

## Reimplemented Protected Functions

virtual void | copy(const QNode * ref)

- 3 protected functions inherited from Qt3D::QNode

### Additional Inherited Members

- 1 property inherited from Qt3D::QNode
- 1 signal inherited from Qt3D::QNode
- 3 protected functions inherited from Qt3D::QNode
- 1 static protected member inherited from Qt3D::QNode

## Detailed Description

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

By itself a Qt3D::QEntity is an empty shell. The behavior of a Qt3D::QEntity object is defined by the Qt3D::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 Qt3D::QTransform component whilst another may focus on Qt3D::QMouseInput.

See also Qt3D::QComponent and Qt3D::QTransform.

## Member Function Documentation

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

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

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

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

Adds a new reference to the component comp.

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

### QComponentList QEntity::components() const

Returns the list of Qt3D::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 Qt3D::QEntity ref to the current instance.

### QEntity * QEntity::parentEntity() const

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

### QNodeId QEntity::parentEntityId() const

Returns the Qt3D::QNodeId id of the parent Qt3D::QEntity instance of the current Qt3D::QEntity object. The QNodeId isNull method will return true if there is no Qt3D::QEntity parent of the current Qt3D::QEntity in the scene hierarchy.

### void QEntity::removeAllComponents()

Remove all references to the components.

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

Removes the reference to comp.