Import c++ type registered with qmlRegisterSingletonType

  • Hi, i've declared a singleton class and registered in with
    @ qmlRegisterSingletonType<presbiopia>("MyClass", 1, 0, "Class",classProvider);@

    where classProvider simply return an instance of MyClass
    then in qml i declare

    @ import MyClass 1.0 @

    and it gives me error such QML module not found, but if i try to call of a property i declared works fine, even with methods. Just it gives me no hints.

    Already tried to clean and build the project.
    Just annoying i know, it works, but is there anyone who as encountered this.
    Thanks A lot!

  • yep, the same for me. Qt Creator marks my import as an error but at the same time I'm able to run my application without any problems. But if I use qmlRegisterType instead of qmlRegisterSingletonType everything is ok.

    It's actually one of the reasons why I'm thinking about using ContextProperty instead of registring singelton

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.