QEntity Class▲
-
Header: QEntity
-
Since: Qt 5.5
-
CMake:
find_package(Qt6 REQUIRED COMPONENTS 3dcore)
target_link_libraries(mytarget PRIVATE Qt6::3dcore)
-
qmake: QT += 3dcore
-
Inherited By: Qt3DExtras::QAbstractCameraController, Qt3DExtras::QSkyboxEntity, Qt3DExtras::QText2DEntity, and Qt3DRender::QCamera
-
Instantiated By: qml-qt3d-core-entity.xml
-
Inherits: Qt3DCore::QNode
-
Inherited By: Qt3DExtras::QAbstractCameraController, Qt3DExtras::QSkyboxEntity, Qt3DExtras::QText2DEntity, and Qt3DRender::QCamera
Detailed Description▲
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.
See Also▲
See also Qt3DCore::QComponent, Qt3DCore::QTransform
Member Function Documentation▲
[explicit] QEntity::QEntity(Qt3DCore::QNode *parent = nullptr)▲
Constructs a new Qt3DCore::QEntity instance with parent as parent.
void QEntity::addComponent(Qt3DCore::QComponent *comp)▲
Adds a new reference to the component comp.
If the 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.
QList<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.