diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2014-09-29 17:19:36 +0200 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2014-10-03 21:18:41 +0200 |
commit | 7b26f6a1746419161a8f875e341b3e31220f4141 (patch) | |
tree | f784e568015e1f7f199abb388b97fefdb158c84e /src/render/frontend/qparameter.cpp | |
parent | c16689bb1ccf31416df7b8c69fe032898cf87dec (diff) |
QNode refactoring
Move almost everything to private classes.
Assimp loading restored.
All examples working.
QNode hierachy is now handled through QObject::setParent, addChild,
removeChild are part of the private api.
Note: commented QChangeArbiter unit tests as they can no longer work with this
patch and will restore them when QChangeArbiter will have been made private.
Task-number: QTBUG-41470
Task-number: QTBUG-41523
Change-Id: I4430974b3aa7f3744c38714b451b122e0cb4d0c9
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/render/frontend/qparameter.cpp')
-rw-r--r-- | src/render/frontend/qparameter.cpp | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/src/render/frontend/qparameter.cpp b/src/render/frontend/qparameter.cpp index 2b4a23017..ab609cbc3 100644 --- a/src/render/frontend/qparameter.cpp +++ b/src/render/frontend/qparameter.cpp @@ -61,17 +61,24 @@ void QParameterPrivate::setValue(const QVariant &v) m_value = v; } +void QParameterPrivate::copy(const QNodePrivate *ref) +{ + QNodePrivate::copy(ref); + const QParameterPrivate *param = static_cast<const QParameterPrivate *>(ref); + m_name = param->m_name; + m_value = param->m_value; + m_isTexture = param->m_isTexture; +} + QParameter::QParameter(QParameterPrivate &dd, QNode *parent) : QNode(dd, parent) - { } -QParameter *QParameter::doClone(bool isClone) const +QParameter *QParameter::doClone() const { QParameter *clone = new QParameter(); - clone->copy(this); - clone->d_func()->m_isClone = isClone; + clone->d_func()->copy(d_func()); return clone; } @@ -96,17 +103,6 @@ QParameter::QParameter(const QString &name, QTexture *texture, QNode *parent) setValue(QVariant::fromValue(texture)); } -void QParameter::copy(const QNode *ref) -{ - Q_D(QParameter); - QNode::copy(ref); - const QParameter *param = qobject_cast<const QParameter *>(ref); - if (param != Q_NULLPTR) { - d->m_name = param->name(); - d->m_value = param->value(); - d->m_isTexture = param->isTextureType(); - } -} void QParameter::setName(const QString &name) { @@ -132,13 +128,13 @@ void QParameter::setValue(const QVariant &dv) // In case texture are declared inline QTexture *txt = dv.value<QTexture *>(); - if ((d->m_isTexture = (txt != Q_NULLPTR)) && (!txt->parent() || txt->parent() == this)) - QNode::addChild(txt); + if ((d->m_isTexture = (txt != Q_NULLPTR)) && !txt->parent()) + txt->setParent(this); QScenePropertyChangePtr change(new QScenePropertyChange(NodeUpdated, this)); change->setPropertyName(d->m_name.toUtf8()); change->setValue(d->m_value); - notifyObservers(change); + d->notifyObservers(change); } } |