Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QtQml qmlRegisterType via .qml file problems

QtQml qmlRegisterType via .qml file problems

Scheduled Pinned Locked Moved Solved QML and Qt Quick
qt5qtqmlqmlqmlregistertype
3 Posts 2 Posters 1.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    aa13q
    wrote on 17 Nov 2015, 20:09 last edited by aa13q
    #1

    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

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 17 Nov 2015, 20:39 last edited by
      #2

      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.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • A Offline
        A Offline
        aa13q
        wrote on 17 Nov 2015, 22:28 last edited by
        #3

        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.

        1 Reply Last reply
        0

        1/3

        17 Nov 2015, 20:09

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved