diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2014-10-16 15:42:04 +0200 |
---|---|---|
committer | Paul Lemire <paul.lemire@kdab.com> | 2014-10-17 21:16:36 +0200 |
commit | 28c986e8be4c3fcb9a1002ab7ef9e8ad1b30ef03 (patch) | |
tree | 690a157d887e03f546ac414f9ed74de5ae363dec /src/quick3d/quick3drenderer | |
parent | 7f2972745acb721bb17378b216f6e5001744ca05 (diff) |
QTechnique: renamed criteria property to annotations
Change-Id: I5a919ac6d0cc5fd7b27a72b22a2a497114241d9d
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/quick3d/quick3drenderer')
-rw-r--r-- | src/quick3d/quick3drenderer/items/quick3dtechnique.cpp | 35 | ||||
-rw-r--r-- | src/quick3d/quick3drenderer/items/quick3dtechnique.h | 18 |
2 files changed, 23 insertions, 30 deletions
diff --git a/src/quick3d/quick3drenderer/items/quick3dtechnique.cpp b/src/quick3d/quick3drenderer/items/quick3dtechnique.cpp index e65c6b1da..b56b41bee 100644 --- a/src/quick3d/quick3drenderer/items/quick3dtechnique.cpp +++ b/src/quick3d/quick3drenderer/items/quick3dtechnique.cpp @@ -102,7 +102,6 @@ void Quick3DTechnique::appendRenderPass(QQmlListProperty<QRenderPass> *list, QRe Quick3DTechnique *technique = qobject_cast<Quick3DTechnique *>(list->object); if (technique) { technique->parentTechnique()->addPass(renderPass); - emit technique->renderPassesChanged(); } } @@ -128,52 +127,50 @@ void Quick3DTechnique::clearRenderPasses(QQmlListProperty<QRenderPass> *list) if (technique) { Q_FOREACH (QRenderPass *pass, technique->parentTechnique()->renderPasses()) technique->parentTechnique()->removePass(pass); - emit technique->renderPassesChanged(); } } -QQmlListProperty<Qt3D::QAnnotation> Quick3DTechnique::criteriaList() +QQmlListProperty<Qt3D::QAnnotation> Quick3DTechnique::annotationList() { return QQmlListProperty<Qt3D::QAnnotation>(this, 0, - &Quick3DTechnique::appendCriterion, - &Quick3DTechnique::criteriaCount, - &Quick3DTechnique::criterionAt, - &Quick3DTechnique::clearCriteriaList); + &Quick3DTechnique::appendAnnotation, + &Quick3DTechnique::annotationCount, + &Quick3DTechnique::annotationAt, + &Quick3DTechnique::clearAnnotationList); } -void Quick3DTechnique::appendCriterion(QQmlListProperty<QAnnotation> *list, QAnnotation *criterion) +void Quick3DTechnique::appendAnnotation(QQmlListProperty<QAnnotation> *list, QAnnotation *annotation) { Quick3DTechnique *technique = qobject_cast<Quick3DTechnique *>(list->object); if (technique) { - if (!criterion->parent()) - criterion->setParent(technique->parentTechnique()); - technique->parentTechnique()->addCriterion(criterion); - emit technique->criteriaChanged(); + if (!annotation->parent()) + annotation->setParent(technique->parentTechnique()); + technique->parentTechnique()->addAnnotation(annotation); } } -QAnnotation *Quick3DTechnique::criterionAt(QQmlListProperty<QAnnotation> *list, int index) +QAnnotation *Quick3DTechnique::annotationAt(QQmlListProperty<QAnnotation> *list, int index) { Quick3DTechnique *technique = qobject_cast<Quick3DTechnique *>(list->object); if (technique) - return technique->parentTechnique()->criteria().at(index); + return technique->parentTechnique()->annotations().at(index); return 0; } -int Quick3DTechnique::criteriaCount(QQmlListProperty<QAnnotation> *list) +int Quick3DTechnique::annotationCount(QQmlListProperty<QAnnotation> *list) { Quick3DTechnique *technique = qobject_cast<Quick3DTechnique *>(list->object); if (technique) - return technique->parentTechnique()->criteria().size(); + return technique->parentTechnique()->annotations().size(); return 0; } -void Quick3DTechnique::clearCriteriaList(QQmlListProperty<QAnnotation> *list) +void Quick3DTechnique::clearAnnotationList(QQmlListProperty<QAnnotation> *list) { Quick3DTechnique *technique = qobject_cast<Quick3DTechnique *>(list->object); if (technique) { - technique->parentTechnique()->clearCriteria(); - emit technique->criteriaChanged(); + Q_FOREACH (QAnnotation *a, technique->parentTechnique()->annotations()) + technique->parentTechnique()->removeAnnotation(a); } } diff --git a/src/quick3d/quick3drenderer/items/quick3dtechnique.h b/src/quick3d/quick3drenderer/items/quick3dtechnique.h index c07fce942..56a7732a9 100644 --- a/src/quick3d/quick3drenderer/items/quick3dtechnique.h +++ b/src/quick3d/quick3drenderer/items/quick3dtechnique.h @@ -57,23 +57,19 @@ namespace Quick { class QT3DQUICKRENDERERSHARED_EXPORT Quick3DTechnique : public QObject { Q_OBJECT - Q_PROPERTY(QQmlListProperty<Qt3D::QAnnotation> criteria READ criteriaList NOTIFY criteriaChanged) - Q_PROPERTY(QQmlListProperty<Qt3D::QRenderPass> renderPasses READ renderPassList NOTIFY renderPassesChanged) + Q_PROPERTY(QQmlListProperty<Qt3D::QAnnotation> annotations READ annotationList) + Q_PROPERTY(QQmlListProperty<Qt3D::QRenderPass> renderPasses READ renderPassList) Q_PROPERTY(QQmlListProperty<Qt3D::QParameter> parameters READ parameterList) public: explicit Quick3DTechnique(QObject *parent = 0); - QQmlListProperty<Qt3D::QAnnotation> criteriaList(); + QQmlListProperty<Qt3D::QAnnotation> annotationList(); QQmlListProperty<Qt3D::QRenderPass> renderPassList(); QQmlListProperty<Qt3D::QParameter> parameterList(); // Use QAbstractTechnique when it has been properly defined inline QTechnique *parentTechnique() const { return qobject_cast<QTechnique*>(parent()); } -Q_SIGNALS: - void criteriaChanged(); - void renderPassesChanged(); - private: static void appendParameter(QQmlListProperty<QParameter> *list, QParameter *param); @@ -81,10 +77,10 @@ private: static int parametersCount(QQmlListProperty<QParameter> *list); static void clearParameterList(QQmlListProperty<QParameter> *list); - static void appendCriterion(QQmlListProperty<QAnnotation> *list, QAnnotation *criterion); - static QAnnotation *criterionAt(QQmlListProperty<QAnnotation> *list, int index); - static int criteriaCount(QQmlListProperty<QAnnotation> *list); - static void clearCriteriaList(QQmlListProperty<QAnnotation> *list); + static void appendAnnotation(QQmlListProperty<QAnnotation> *list, QAnnotation *Annotation); + static QAnnotation *annotationAt(QQmlListProperty<QAnnotation> *list, int index); + static int annotationCount(QQmlListProperty<QAnnotation> *list); + static void clearAnnotationList(QQmlListProperty<QAnnotation> *list); static void appendRenderPass(QQmlListProperty<QRenderPass> *list, QRenderPass* renderPass); static QRenderPass *renderPassAt(QQmlListProperty<QRenderPass> *list, int index); |