QtQml qmlRegisterType via .qml file problems



  • Is it possible to register qml type directly from qml file by uri, without having a cpp class?

    registerQmlType returns 0 from qrc, absolute file path or any uri :

    // ...
    
    qDebug()<<qmlRegisterType(QUrl("qrc:/file.qml"),"org,noname",0,1,"MyType");
    
    qDebug()<<qmlRegisterType(QUrl::fromLocalFile("file:///absolute/path/to/file.qml"),"org,noname",0,1,"MyType");
    
    qDebug()<<qmlRegisterType(QUrl("http://mydomain/file.qml"),"org,noname",0,1,"MyType");
    
    // ...
    

    p.s.: Qt5.5, archlinux x86_64


  • Lifetime Qt Champion

    Hi,

    From a quick look a the doc, it seems it means the registration is successful since it doesn't return -1, however it seems there's a typo in your uri, you have a comma instead of a dot.



  • Sorry, everything is ok now. It's not about the typo in the forum, but in my project.
    Tried to build minimal working example -- working without any problems.


Log in to reply
 

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