Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Using namespace in QML



  • Hi all, Anybody know how to do this ?

    I have a class which is derived from QQuickPaintedItem, which i used in my QML side for my custom drawing. Say MyGraphicScene.
    and i have another class say BaseShape which is derived from QObject, and have a 'has a' relation ship with my MyGraphicScene class.
    I my case all these class are under the namesapce called MyyApp::MyGraphicApp

    namespace MyyApp
    {
    namesapce MyGraphicApp
    {
    class MyGraphicScene: public QQuickPaintedItem
    {......
    BaseShape* pShape;
    };
    }
    }

    so when i compile this, its fine, but during runtime, my plugin library could not be loaded beacuse of the undefined symbol error, when i remove the name space, everything works fine...
    Can anybody tell me why namespace is not recognize in QML, any solution please, I should go with name space anyway,



  • How do you register the type in QML?



  • @Praveen-kk said:

    BaseShape

    I have registerd both BaseShape and MyGraphicScene class using qmlRegisterType<>()
    Only problem when using the name space.


Log in to reply