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,
void QAspectEngine::registerAspect(Qt3DCore::QAbstractAspect *aspect)
将一个新的aspect 注册到AspectManager中。QAspectEngine 将拥有该切面的所有权,并在切面被注销时将其删除。
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 的方面。
© 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.