Important: Please read the Qt Code of Conduct -

Make QtCreator recognize the use of qmlRegisterSingletonType (QML module not found)

  • Hello everybody!

    I have a simple question about QML module. I am using Qt 5.13.2 and I have declared C++ singleton in the main.cpp, like this:

    qmlRegisterSingletonType(QUrl("qrc:/Something.qml"), "namespace.other", 1, 0, "Something");

    That's working, no problem.

    But if I create a method which doing this (to simplify my declarations):

    int registerQmlSingleton(const QString &namespaceName,
                                         const QString &singletonName,
                                         int versionMajor = 1,
                                         int versionMinor = 0)
        return qmlRegisterSingletonType(

    All build and run without problems, but in the editor QtCreator doesn't recognize the modules and warns in QML files for "namespace.other": QML module not found.

    Is there a way to tell to QtCreator that a module is registered? Something with comment in code, or else?

    Thanks for your help!

Log in to reply