diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2016-02-22 19:50:43 +0100 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2016-02-22 21:17:46 +0000 |
commit | 082c247cf859a145847ffe440b2e16994e0bf71a (patch) | |
tree | 62ff9f17505c9ec7e63b9d1dae9e58016319344d /src/core/aspects | |
parent | 324ed1663a125cc46376d34e6374caea428debe6 (diff) |
QAspectEngine::setRootEntity takes a QSharedPointer
Change-Id: Ia1cb3f216a4a828890ac53d5a025ca0dd970dc85
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/core/aspects')
-rw-r--r-- | src/core/aspects/qaspectengine.cpp | 12 | ||||
-rw-r--r-- | src/core/aspects/qaspectengine.h | 6 |
2 files changed, 10 insertions, 8 deletions
diff --git a/src/core/aspects/qaspectengine.cpp b/src/core/aspects/qaspectengine.cpp index ccccc6952..9422a4471 100644 --- a/src/core/aspects/qaspectengine.cpp +++ b/src/core/aspects/qaspectengine.cpp @@ -116,7 +116,7 @@ QAspectEngine::QAspectEngine(QObject *parent) QAspectEngine::~QAspectEngine() { Q_D(QAspectEngine); - setRootEntity(Q_NULLPTR); + setRootEntity(QEntityPtr()); delete d->m_aspectThread; delete d->m_postman; delete d->m_scene; @@ -234,7 +234,7 @@ QVariant QAspectEngine::executeCommand(const QString &command) return QVariant(); } -void QAspectEngine::setRootEntity(QEntity *root) +void QAspectEngine::setRootEntity(QEntityPtr root) { qCDebug(Aspects) << "Setting scene root on aspect manager"; Q_D(QAspectEngine); @@ -246,7 +246,7 @@ void QAspectEngine::setRootEntity(QEntity *root) // Set the new root object. This will cause the old tree to be deleted // and the deletion of the old frontend tree will cause the backends to // free any related resources - d->m_root.reset(root); + d->m_root = root; if (shutdownNeeded) d->shutdown(); @@ -266,7 +266,7 @@ void QAspectEngine::setRootEntity(QEntity *root) // scene object and adding each node to the scene // TODO: We probably need a call symmetric to this one above in order to // deregister the nodes from the scene - d->initNodeTree(root); + d->initNodeTree(root.data()); // Finally, tell the aspects about the new scene object tree. This is done // in a blocking manner to allow the backends to get synchronized before the @@ -274,11 +274,11 @@ void QAspectEngine::setRootEntity(QEntity *root) QMetaObject::invokeMethod(d->m_aspectThread->aspectManager(), "setRootEntity", Qt::BlockingQueuedConnection, - Q_ARG(Qt3DCore::QEntity *, root)); + Q_ARG(Qt3DCore::QEntity *, root.data())); qCDebug(Aspects) << "Done setting scene root on aspect manager"; } -QSharedPointer<QEntity> QAspectEngine::rootEntity() const +QEntityPtr QAspectEngine::rootEntity() const { Q_D(const QAspectEngine); return d->m_root; diff --git a/src/core/aspects/qaspectengine.h b/src/core/aspects/qaspectengine.h index 402a128df..bbeee0998 100644 --- a/src/core/aspects/qaspectengine.h +++ b/src/core/aspects/qaspectengine.h @@ -55,6 +55,8 @@ class QAspectEnginePrivate; class QEntity; class QNode; +typedef QSharedPointer<QEntity> QEntityPtr; + class QT3DCORESHARED_EXPORT QAspectEngine : public QObject { Q_OBJECT @@ -62,8 +64,8 @@ public: explicit QAspectEngine(QObject *parent = 0); ~QAspectEngine(); - void setRootEntity(QEntity *root); - QSharedPointer<QEntity> rootEntity() const; + void setRootEntity(QEntityPtr root); + QEntityPtr rootEntity() const; void registerAspect(QAbstractAspect *aspect); void registerAspect(const QString &name); |