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. I can not import anything in qml
QtWS25 Last Chance

I can not import anything in qml

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
qmljavascriptqt5import
3 Posts 2 Posters 1.6k 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.
  • D Offline
    D Offline
    Dante Leoncini
    wrote on 4 Feb 2018, 17:50 last edited by
    #1

    good, I'm doing a port from qt 4.8 to 5.10. what the program does is open other programs made in qml and javascript.
    start with a qml with the wallpaper and import a panel similar to windows 7

    Rectangle { //Panel personalizado
        Loader {source: "temas/"+tema+"/panel/panel.qml"}
    }
    

    in that qml if it works when I want to import

    import "componentCreation.js" as MyScript
    

    from there I can open the "programs" but those that have to import something throw the following error. example:

    import "content"
    import "content/calculator.js" as CalcEngine
    

    gives the following error

    "file:qml/aplicaciones/calqlatr/calqlatr.qml:52:1: import "content" has no qmldir and no namespace"

    I do not understand why with the panel it works and with the rest of the qml

    I leave a video of the program running in symbian with qt 4.8
    https://www.youtube.com/watch?v=C4aJ_J401Qc&t=2s

    original:
    buenas, estoy haciendo un port de qt 4.8 a 5.10. lo que hace el programa es abrir otros programas hechos en qml y javascript.

    Rectangle { //Panel personalizado
        Loader {source: "temas/"+tema+"/panel/panel.qml"}
    }
    

    en ese qml si funciona cuando quiero importar

    import "componentCreation.js" as MyScript
    

    desde ahi puedo abrir los "programas" pero los que tengan que importar algo tiran el siguiente error, ejemplo:

    import "content"
    import "content/calculator.js" as CalcEngine
    

    devuelve el error:

    "file:qml/aplicaciones/calqlatr/calqlatr.qml:52:1: import "content" has no qmldir and no namespace"

    no entiendo porque con el panel si funciona y con el resto de qml no

    les dejo un video del programa funcionando en symbian con qt 4.8
    https://www.youtube.com/watch?v=C4aJ_J401Qc&t=2s

    1 Reply Last reply
    0
    • P Offline
      P Offline
      Pablo J. Rogina
      wrote on 5 Feb 2018, 11:01 last edited by
      #2

      @Dante-Leoncini

      import "content" has no qmldir and no namespace"

      it seems to have issues with qmldir file(s). You may want to take a look at the documentation

      Upvote the answer(s) that helped you solve the issue
      Use "Topic Tools" button to mark your post as Solved
      Add screenshots via postimage.org
      Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • D Offline
        D Offline
        Dante Leoncini
        wrote on 7 Feb 2018, 03:14 last edited by
        #3

        try to create a qmldir file, but it did not work

        look for the error but I found nothing that serves me. I do not know if it has to do with the fact that I'm not using a qrc file.

        in the ".pro" file, add a line to copy and paste the "qml" folder into the compiled directory. that's because I want the code jv and qml can be edited with any editor in the final version

        #Copia la carpeta "qml" dentro de la carpeta build
        copydata.commands = $(COPY_DIR) $$PWD/qml $$OUT_PWD
        first.depends = $(first) copydata
        export(first.depends)
        export(copydata.commands)
        QMAKE_EXTRA_TARGETS += first copydata
        
        1 Reply Last reply
        0

        3/3

        7 Feb 2018, 03:14

        • Login

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