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. Multiple directories in qmlproject file

Multiple directories in qmlproject file

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 3.1k Views 1 Watching
  • 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.
  • E Offline
    E Offline
    ephe
    wrote on last edited by
    #1

    Is it possible to define more than one directory to the image files (or QML files,...) in the qmlproject file?
    E.g.
    @
    ImageFiles {
    directory: "../images"
    directory: "C:/path/to/my/images"
    directory: "."
    }
    @

    1 Reply Last reply
    0
    • F Offline
      F Offline
      favoritas37
      wrote on last edited by
      #2

      you can try using the import command at the beginning of the .qml file to use folders other that the current:
      @
      import "../images"

      Rectangle{
      ...
      }
      @

      1 Reply Last reply
      0
      • E Offline
        E Offline
        ephe
        wrote on last edited by
        #3

        I have got the "images" folder in the same directory as all my qml files.

        When I try
        @import "../images"@
        , I get the following error: "../images": no such directory

        when I try
        @import "./images"@
        , I don't get an error, but what should I set as the source of the images?
        If I just set
        @source: "MyImage.png"@
        , it has the wrong path. And if I set @source: "images/MyImage.png"@ it works, but then I wouldn't need the import anyway.

        I've got the same problem when I set the directory in the qmlproject file. I still have to set "images/MyImage.png" as the source. Maybe I didn't understand the usage of the directory property. Can you please explain it to me?

        1 Reply Last reply
        0

        • Login

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