summaryrefslogtreecommitdiffstats
path: root/examples/qt3d/tessellation-modes
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2015-07-20 09:10:08 +0200
committerSean Harmer <sean.harmer@kdab.com>2015-07-28 09:49:19 +0000
commit90623e3ccbeba4f498b3ce5c1b6c88f1122df434 (patch)
tree2e7a5b59b3d6830d0f0d70f1c1cec5cb6f355a9e /examples/qt3d/tessellation-modes
parent3fe37f854dcaa2d92e8936ccddd07800fb4d04d3 (diff)
Functors: remove dynamic_cast
Introduce a QAbstractFunctor class which QAbstractMeshFunctor and QTextureDataFunctor subclass Make all QAbstractFunctor subclasses implement an id() function (using QT3D_FUNCTOR(Class)). Use this id to compare to other QAbstractMeshFunctor and eventually static_cast into right type if possible using the functor_cast member function. Change-Id: Iface956e6cd818cbef204d8fa7bf2bc23c6ffa3f Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'examples/qt3d/tessellation-modes')
-rw-r--r--examples/qt3d/tessellation-modes/tessellatedquadmesh.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/qt3d/tessellation-modes/tessellatedquadmesh.cpp b/examples/qt3d/tessellation-modes/tessellatedquadmesh.cpp
index 08a3f54b3..630fa1061 100644
--- a/examples/qt3d/tessellation-modes/tessellatedquadmesh.cpp
+++ b/examples/qt3d/tessellation-modes/tessellatedquadmesh.cpp
@@ -83,11 +83,13 @@ public:
bool operator ==(const Qt3D::QAbstractMeshFunctor &other) const
{
- const TessellatedQuadMeshFunctor *otherFunctor = dynamic_cast<const TessellatedQuadMeshFunctor *>(&other);
+ const TessellatedQuadMeshFunctor *otherFunctor = functor_cast<TessellatedQuadMeshFunctor>(&other);
if (otherFunctor != Q_NULLPTR)
return true;
return false;
}
+
+ QT3D_FUNCTOR(TessellatedQuadMeshFunctor)
};
Qt3D::QAbstractMeshFunctorPtr TessellatedQuadMesh::meshFunctor() const