Qt3DCore::QComponent Class
class Qt3DCore::QComponent场景节点的基类,可通过Qt3DCore::QEntity 实例聚合为一个组件。更多
头文件: | #include <QComponent> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS 3DCore) target_link_libraries(mytarget PRIVATE Qt6::3DCore) |
qmake: | QT += 3dcore |
在 QML 中: | Component3D |
继承: | Qt3DCore::QNode |
继承于 | 24 类型Qt3DAnimation::QAbstractClipAnimator,Qt3DCore::QArmature,Qt3DCore::QBoundingVolume,Qt3DCore::QCoreSettings,Qt3DCore::QTransform,Qt3DInput::QAxisAccumulator,Qt3DInput::QInputSettings,Qt3DInput::QKeyboardHandler,Qt3DInput::QLogicalDevice,Qt3DInput::QMouseHandler,Qt3DLogic::QFrameAction,Qt3DRender::QAbstractLight,Qt3DRender::QAbstractRayCaster,Qt3DRender::QCameraLens,Qt3DRender::QComputeCommand,Qt3DRender::QEnvironmentLight,Qt3DRender::QLayer,Qt3DRender::QLevelOfDetail,Qt3DRender::QMaterial,Qt3DRender::QObjectPicker,Qt3DRender::QRenderSettings,Qt3DRender::QRenderTarget,Qt3DRender::QSceneLoader, andQt3DRender::QShaderData |
状态: | 已废弃 |
属性
- isShareable : bool
公共功能
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 的可共享标志。如果true
,QComponent 可在多个实体间共享。
访问功能:
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.