Qt3DCore::QAspectEngine Class

class Qt3DCore::QAspectEngine

负责处理所有已在场景中注册的QAbstractAspect 子类。更多

头文件: #include <Qt3DCore/QAspectEngine>
CMake: find_package(Qt6 REQUIRED COMPONENTS 3DCore)
target_link_libraries(mytarget PRIVATE Qt6::3DCore)
qmake: QT += 3dcore
继承: QObject
状态:已废弃

公共函数

QAspectEngine(QObject *parent = nullptr)
virtual ~QAspectEngine()
Qt3DCore::QAbstractAspect *aspect(const QString &name) const
QList<Qt3DCore::QAbstractAspect *> aspects() const
QVariant executeCommand(const QString &command)
void processFrame()
void registerAspect(Qt3DCore::QAbstractAspect *aspect)
void registerAspect(const QString &name)
Qt3DCore::QEntityPtr rootEntity() const
void setRootEntity(Qt3DCore::QEntityPtr root)
void unregisterAspect(Qt3DCore::QAbstractAspect *aspect)
void unregisterAspect(const QString &name)

详细描述

Qt3D 运行循环由 Qt3DRender::QAspectEngine 控制。

Qt3DCore::QAbstractAspect 子类可通过调用 Qt3DCore::QAspectEngine::registerAspect() 进行注册,该函数将负责注册该方面,并反过来调用 Qt3DCore::QAbstractAspect::onRegistered() ;

一旦在Qt3DCore::QAspectEngine 上设置了根Qt3DCore::QEntity ,模拟循环就会启动。随后,每个方面都会调用 onEngineStartup(),以便开始模拟工作。

当根实体被设置为 Qt3DCore::QEntityPtr() 时,模拟循环就会停止。这将调用每个方面的 onEngineShutdown(),以便它们停止执行模拟工作。

设置新的有效根实体将重新启动模拟循环。

成员函数文档

[explicit] QAspectEngine::QAspectEngine(QObject *parent = nullptr)

通过parent 构建一个新的 QAspectEngine。

[virtual noexcept] QAspectEngine::~QAspectEngine()

破坏发动机

Qt3DCore::QAbstractAspect *QAspectEngine::aspect(const QString &name) const

返回与name

注: 要求该方面已按名称注册

QList<Qt3DCore::QAbstractAspect *> QAspectEngine::aspects() const

返回方面引擎拥有的方面。

QVariant QAspectEngine::executeCommand(const QString &command)

在方面引擎上执行给定的command 。有效命令包括

  • "list aspects

返回命令的回复。

void QAspectEngine::processFrame()

如果使用手动运行模式,该函数将执行每个方面的作业。它是阻塞式的,直到所有作业完成后才会返回。

如果您使用的是 QRenderAspect.NET,那么该函数将执行每个方面的作业、

void QAspectEngine::registerAspect(Qt3DCore::QAbstractAspect *aspect)

向 AspectManager 注册一个新的aspectQAspectEngine 拥有该方面的所有权,并将在取消注册时删除该方面。

void QAspectEngine::registerAspect(const QString &name)

根据name 向 AspectManager 注册一个新的方面。使用当前设置的方面工厂创建实际的方面实例。

Qt3DCore::QEntityPtr QAspectEngine::rootEntity() const

返回方面引擎的根实体。

另请参阅 setRootEntity()。

void QAspectEngine::setRootEntity(Qt3DCore::QEntityPtr root)

为方面引擎设置root 实体。

另请参阅 rootEntity().

void QAspectEngine::unregisterAspect(Qt3DCore::QAbstractAspect *aspect)

取消注册并删除给定的aspect

void QAspectEngine::unregisterAspect(const QString &name)

取消注册并删除带有给定name 的方面。

相关非会员

QEntityPtr

QEntity 的共享指针。

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