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

Qt 5.6.3 Reference Documentation

# QComponent Class

(Qt3DCore::QComponent)

The base class of scene nodes that can be aggregated by Qt3DCore::QEntity instances as a component. More...

Header: | #include <QComponent>
qmake: | QT += 3dcore
Since: | Qt 5.5
Instantiated By: | Component3D
Inherits: | QNode
Inherited By: | Qt3DCore::QCameraLens, Qt3DInput::QAxisActionHandler, Qt3DInput::QKeyboardInput, Qt3DInput::QMouseInput, Qt3DLogic::QLogicComponent, Qt3DRender::QFrameGraph, Qt3DRender::QGeometryRenderer, Qt3DRender::QLayer, Qt3DRender::QMaterial, Qt3DRender::QObjectPicker, and Qt3DRender::QShaderData

- List of all members, including inherited members

## Properties

- shareable : bool

- 2 properties inherited from Qt3DCore::QNode

## Public Functions

| QComponent(QNode *parent = Q_NULLPTR)
| ~QComponent()
QVector<QEntity *> | entities() const
bool | shareable() const

- 6 public functions inherited from Qt3DCore::QNode

## Public Slots

void | setShareable(bool shareable)

- 2 public slots inherited from Qt3DCore::QNode

## Signals

void | enabledChanged(bool enabled)
void | shareableChanged(bool shareable)

- 2 signals inherited from Qt3DCore::QNode

## Reimplemented Protected Functions

virtual void | copy(const QNode *ref)

- 3 protected functions inherited from Qt3DCore::QNode

### Additional Inherited Members

- 3 protected functions inherited from Qt3DCore::QNode
- 1 static protected member inherited from Qt3DCore::QNode

## Detailed Description

The base class of scene nodes that can be aggregated by Qt3DCore::QEntity instances as a component.

A Qt3DCore::QComponent provides a vertical slice of behavior that can be assigned to and sometimes shared across Qt3DCore::QEntity instances.

Qt3DCore::QComponent subclasses are often aggregated in groups that impart useful behavior to the aggregating entity. For example, to have an Entity that gets drawn by the Qt3D renderer aspect, an entity would most likely aggregate Qt3DCore::QTransform, Qt3DRender::QMesh, and Qt3DRender::QMaterial components.

See also Qt3DCore::QEntity.

## Property Documentation

### shareable : bool

Access functions:

bool | shareable() const
void | setShareable(bool shareable)

Notifier signal:

void | shareableChanged(bool shareable)

## Member Function Documentation

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

Constructs a new QComponent instance with parent as the parent.

Note: a QComponent should never be instanced directly, instance one of the subclasses instead.

### QComponent::~QComponent()

Destroys the instance of QComponent.

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

### `[signal]` void QComponent::enabledChanged(bool enabled)

### QVector<QEntity *> QComponent::entities() const

Returns a QVector containing all the entities that reference this component.

### `[slot]` void QComponent::setShareable(bool shareable)

The QComponent can be shared across several entities if shareable is true.

Note: Setter function for property shareable.

See also shareable().

### bool QComponent::shareable() const

Returns whether the QComponent is shareable across entities or not.

Note: Getter function for property shareable.

See also setShareable().