/Qt 5.11

QAspectEngine Class


Responsible for handling all the QAbstractAspect subclasses that have been registered with the scene. More...

Header: #include <Qt3DCore/QAspectEngine>
qmake: QT += 3dcore
Inherits: QObject

Public Functions

QAspectEngine(QObject *parent = nullptr)
virtual ~QAspectEngine()
QVector<Qt3DCore::QAbstractAspect *> aspects() const
QVariant executeCommand(const QString &command)
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)
  • 34 public functions inherited from QObject
typedef QEntityPtr

Additional Inherited Members

  • 1 property inherited from QObject
  • 1 public slot inherited from QObject
  • 2 signals inherited from QObject
  • 1 public variable inherited from QObject
  • 10 static public members inherited from QObject
  • 9 protected functions inherited from QObject
  • 2 protected variables inherited from QObject

Detailed Description

Responsible for handling all the QAbstractAspect subclasses that have been registered with the scene.

The Qt3D run loop is controlled by the Qt3DRender::QAspectEngine.

Qt3DCore::QAbstractAspect subclasses can be registered by calling Qt3DCore::QAspectEngine::registerAspect() which will take care of registering the aspect and in turn that will call Qt3DCore::QAbstractAspect::onRegistered();

The simulation loop is launched as soon as a root Qt3DCore::QEntity is set on the Qt3DCore::QAspectEngine. This is followed by a call to onEngineStartup() on each aspect so that they can start their simulation work.

The simulation loop is stopped when the root entity is set to Qt3DCore::QEntityPtr(). This calls onEngineShutdown() on each aspect so that they can stop performing their simulation work.

Setting a new valid root entity would restart the simulation loop again.

Member Function Documentation

QAspectEngine::QAspectEngine(QObject *parent = nullptr)

Constructs a new QAspectEngine with parent.

[virtual] QAspectEngine::~QAspectEngine()

Destroys the engine.

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

Returns the aspects owned by the aspect engine.

QVariant QAspectEngine::executeCommand(const QString &command)

Executes the given command on aspect engine. Valid commands are:

  • "list aspects"

Returns the reply for the command.

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

* Registers a new aspect to the AspectManager. The QAspectEngine takes * ownership of the aspect and will delete it when the aspect is unregistered.

void QAspectEngine::registerAspect(const QString &name)

Registers a new aspect to the AspectManager based on its name Uses the currently set aspect factory to create the actual aspect instance.

Qt3DCore::QEntityPtr QAspectEngine::rootEntity() const

Returns the root entity of the aspect engine.

See also setRootEntity().

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

Sets the root entity for the aspect engine.

See also rootEntity().

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

Unregisters and deletes the given aspect.

void QAspectEngine::unregisterAspect(const QString &name)

Unregisters and deletes the aspect with the given name.

Related Non-Members

typedef Qt3DCore::QEntityPtr

A shared pointer for QEntity.

© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.