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. import qml files from subfolder fails
Qt 6.11 is out! See what's new in the release blog

import qml files from subfolder fails

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 457 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.
  • S Offline
    S Offline
    sandro4912
    wrote on last edited by
    #1

    I have the following project structure:

    d495b363-21ed-4627-b3a0-63386f09e6b9-image.png

    Now in the file calqlatr.qml I want to use the qml files from the subfolder content

    if I add

    import "content"
    

    In calqlatr.qml it looks fine but when I try to run the app i get this error:

    QML debugging is enabled. Only use this in a safe environment.
    qrc:calqlatr.qml:2:1: import "content" has no qmldir and no namespace 
         import "content" 
         ^
    

    What Is wrong here? Whats the correct way to import qml files from a subfolder?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sandro4912
      wrote on last edited by
      #2

      Found the issue myself.

      I wrote in the main.cpp:

      view.setSource(QUrl("qrc:calqlatr.qml"));
      

      instead of

      view.setSource(QUrl("qrc:/calqlatr.qml"));
      
      1 Reply Last reply
      1

      • Login

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