Qt3DCore::QComponent Class

class Qt3DCore::QComponent

场景节点的基类,可通过Qt3DCore::QEntity 实例聚合为一个组件。更多

属性

公共功能

QComponent(Qt3DCore::QNode *parent = nullptr)
QList<Qt3DCore::QEntity *> entities() const
bool isShareable() const

公共插槽

void setShareable(bool isShareable)

信号

void addedToEntity(Qt3DCore::QEntity *entity)
void removedFromEntity(Qt3DCore::QEntity *entity)
void shareableChanged(bool isShareable)

详细说明

Qt3DCore::QComponent 提供了一个垂直的行为片段,可以分配给Qt3DCore::QEntity 实例,有时还可以在 实例之间共享。

Qt3DCore::QComponent 子类通常被聚合成组,向聚合实体传递有用的行为。例如,若要获得一个由 Qt3D 渲染器绘制的实体(Entity),该实体很可能会聚合 、 和 组件。Qt3DCore::QTransform Qt3DRender::QMesh Qt3DRender::QMaterial

另请参阅 Qt3DCore::QEntity

属性文档

isShareable : bool

持有QComponent 的可共享标志。如果trueQComponent 可在多个实体间共享。

访问功能:

bool isShareable() const
void setShareable(bool isShareable)

Notifier 信号:

void shareableChanged(bool isShareable)

成员函数 文档

[explicit] QComponent::QComponent(Qt3DCore::QNode *parent = nullptr)

构建一个新的 QComponent 实例,父类为parent

注意: 切勿直接实例化 QComponent,而应实例化其中一个子类。

[signal] void QComponent::addedToEntity(Qt3DCore::QEntity *entity)

表示在entity 中添加了引用。

QList<Qt3DCore::QEntity *> QComponent::entities() const

返回QList ,其中包含引用此组件的所有实体。

[signal] void QComponent::removedFromEntity(Qt3DCore::QEntity *entity)

表示引用已从entity 中删除。

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.