From 90623e3ccbeba4f498b3ce5c1b6c88f1122df434 Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Mon, 20 Jul 2015 09:10:08 +0200 Subject: 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 --- examples/qt3d/tessellation-modes/tessellatedquadmesh.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'examples/qt3d/tessellation-modes') 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(&other); + const TessellatedQuadMeshFunctor *otherFunctor = functor_cast(&other); if (otherFunctor != Q_NULLPTR) return true; return false; } + + QT3D_FUNCTOR(TessellatedQuadMeshFunctor) }; Qt3D::QAbstractMeshFunctorPtr TessellatedQuadMesh::meshFunctor() const -- cgit v1.2.3