Qt World Summit: Submit your Presentation

Qt3D 2.0 subclassing Qt3D::QCylinderMesh

  • Hi everyone,

    In order to make an arrow in Qt3D, i tried creating a Qt3D::QConeMesh by subclassing Qt3D::QCylinderMesh, and then overwriting the functions so that they can take 2 radii (for a cone fustrum), and calculate the vertices in there accordingly:

    void createSides( ..., double radius1, double radius2 ... ) {...}
    QMeshDataPtr createConeMesh (..., double radius1, double radius2 ... ) {...} 

    I was assuming that the rest of the functionality is basically copied from QCylinderMesh in the inheritance. But I can't make it work.

    What is weird, if I subclass it without altering any functionality, essentially qconemesh.h like this:

    class QT3DRENDERERSHARED_EXPORT QConeMesh : public Qt3D::QCylinderMesh 
    {  Q_OBJECT };

    and an empty qconemesh.cpp, then it "works" in the way that I can then call QConeMesh (and obviously get a cylinder).

    Am I missing something?

    Thanks & Cheers, Carl

Log in to reply