このページでは

Qt3DCore::QEntity Class

class Qt3DCore::QEntity

Qt3DCore::QEntity Qt3DCore::QNode のサブクラスであり、その動作を規定する複数の インスタンスを集約することができます。Qt3DCore::QComponent 詳細...

ヘッダー: #include <QEntity>
CMake: find_package(Qt6 REQUIRED COMPONENTS 3DCore)
target_link_libraries(mytarget PRIVATE Qt6::3DCore)
qmake: QT += 3dcore
QML内: Entity
継承元: Qt3DCore::QNode
継承元:

Qt3DExtras::QAbstractCameraController、Qt3DExtras::QSkyboxEntity 、Qt3DExtras::QText2DEntity 、およびQt3DRender::QCamera

ステータス: 非推奨

このクラスは非推奨です。新しいコードでの使用は強く推奨しません。

パブリック関数

QEntity(Qt3DCore::QNode *parent = nullptr)
void addComponent(Qt3DCore::QComponent *comp)
Qt3DCore::QComponentVector components() const
QList<T *> componentsOfType() const
Qt3DCore::QEntity *parentEntity() const
void removeComponent(Qt3DCore::QComponent *comp)

詳細な説明

Qt3DCore::QEntity 自体は、空のシェルにすぎません。Qt3DCore::QEntity オブジェクトの挙動は、それが参照するQt3DCore::QComponent オブジェクトによって定義されます。各Qt3Dバックエンドアスペクトは、エンティティを構成するコンポーネントを認識することで、そのエンティティを解釈および処理することができます。あるアスペクトは、単一のQt3DCore::QTransform コンポーネントで構成されるエンティティのみを処理することに決定する一方で、別のアスペクトはQt3DInput::QMouseHandler に焦点を当てるかもしれません。

Qt3DCore::QComponent およびQt3DCore::QTransformも参照してください 。

メンバー関数のドキュメント

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

parent を親として、新しいQt3DCore::QEntity インスタンスを作成します。

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

コンポーネント `comp` への新しい参照を追加します。

注: Qt3DCore::QComponent に親が存在しない場合 、Qt3DCore::QEntity は自身をその親として設定し、そのコンポーネントの所有権を取得します。

Qt3DCore::QComponentVector QEntity::components() const

そのエンティティが参照している Qt3DCore::QComponent インスタンスのリストを返します。

template <typename T> QList<T *> QEntity::componentsOfType() const

このエンティティに追加されたコンポーネントのうち、型 T にキャスト可能なものをすべて返します。そのようなコンポーネントが存在しない場合は、空のベクトルを返します。

Qt3DCore::QEntity *QEntity::parentEntity() const

このエンティティの親となるQt3DCore::QEntity インスタンスを返します。直上の親がQt3DCore::QEntity でない場合、この関数は親のQt3DCore::QEntity が見つかるまでシーン階層を上方向に探索します。Qt3DCore::QEntity の親が見つからない場合は、nullを返します。

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

comp への参照を削除します。

関連する非会員

[alias] QComponentVector

QComponent ポインタの一覧。

© 2026 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.