Multiple directories in qmlproject file

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

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


  • 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?

Log in to reply

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