diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2015-10-01 15:55:17 +0200 |
---|---|---|
committer | Paul Lemire <paul.lemire@kdab.com> | 2015-10-14 16:01:37 +0000 |
commit | 65d1fbb704706a6701e8e554d555a9b71053c0bc (patch) | |
tree | 7ee3cc4a94dfd48db4d85cda5bf648f3e50cefc3 /src/render/framegraph/qtechniquefilter.cpp | |
parent | c4e63d3eb687d2e7d4267e97d8a6122d0012529a (diff) |
QTechniqueFilter fixes:
- Properly clone the parameters when doing a clone
- Sent QAnnotation QNodeId only, not clones
- Check that a QAnnotation is not already contained when inserting a new one
Change-Id: Ie00410c107b41bebccccd670feb02e2bfd30b84e
Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
Diffstat (limited to 'src/render/framegraph/qtechniquefilter.cpp')
-rw-r--r-- | src/render/framegraph/qtechniquefilter.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/render/framegraph/qtechniquefilter.cpp b/src/render/framegraph/qtechniquefilter.cpp index e2dd7c081..37fad6f70 100644 --- a/src/render/framegraph/qtechniquefilter.cpp +++ b/src/render/framegraph/qtechniquefilter.cpp @@ -63,6 +63,8 @@ void QTechniqueFilter::copy(const QNode *ref) Q_FOREACH (QAnnotation *crit, other->d_func()->m_requireList) addRequirement(qobject_cast<QAnnotation *>(QNode::clone(crit))); + Q_FOREACH (QParameter *p, other->d_func()->m_parameters) + addParameter(qobject_cast<QParameter *>(QNode::clone(p))); } QTechniqueFilter::QTechniqueFilter(QNode *parent) @@ -90,20 +92,22 @@ QList<QAnnotation *> QTechniqueFilter::criteria() const void QTechniqueFilter::addRequirement(QAnnotation *criterion) { Q_D(QTechniqueFilter); - d->m_requireList.append(criterion); + if (!d->m_requireList.contains(criterion)) { + d->m_requireList.append(criterion); - // We need to add it as a child of the current node if it has been declared inline - // Or not previously added as a child of the current node so that - // 1) The backend gets notified about it's creation - // 2) When the current node is destroyed, it gets destroyed as well - if (!criterion->parent()) - criterion->setParent(this); + // We need to add it as a child of the current node if it has been declared inline + // Or not previously added as a child of the current node so that + // 1) The backend gets notified about it's creation + // 2) When the current node is destroyed, it gets destroyed as well + if (!criterion->parent()) + criterion->setParent(this); - if (d->m_changeArbiter != Q_NULLPTR) { - QScenePropertyChangePtr propertyChange(new QScenePropertyChange(NodeAdded, QSceneChange::Node, id())); - propertyChange->setPropertyName("require"); - propertyChange->setValue(QVariant::fromValue(criterion)); - d->notifyObservers(propertyChange); + if (d->m_changeArbiter != Q_NULLPTR) { + QScenePropertyChangePtr propertyChange(new QScenePropertyChange(NodeAdded, QSceneChange::Node, id())); + propertyChange->setPropertyName("require"); + propertyChange->setValue(QVariant::fromValue(criterion->id())); + d->notifyObservers(propertyChange); + } } } |