how to add qml files of an upper directory to qrc (../src/qmlfiles) ?

  • Hey guys,

    I have a directory-structure like this:

    ├─ defaults.pri
    ├─ apps/
    │  ├─
    │  ├─ app1/
    │  └─ app2/
    │      ├─
    │      └─ main.cpp
    ├─ src/
    │  ├─ class1.cpp
    │  ├─ class2.cpp
    │  └─ qmlfiles/
    │       ├─ Button1.qml
    │       └─ Button2.qml
    └─ tests/
       └─ main.cpp

    Lets say I'm in
    When I add button1.qml to qml.qrc it will look like this:


    Now I want to add this button to main.qml, so I import it like this:

    import "../../src/qmlfiles/"

    No problems so far. Qt Designer even shows the button as expected.
    As soon as I start my application it says

    QQmlApplicationEngine failed to load component
    qrc:/main.qml:4 "../../src/qmlfiles/": no such directory

    Any idea how I can solve this problem?


Log in to reply

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