Creating directory and subdirectory structure for qml and C++ files



  • Hello friends,

    I am trying to put my qml files into qml folder such that it becomes:

    qml/main.qml, qml/Page1.qml and qml/Page1Form.ui.qml.

    After creating above folder with above files, I added in my .pro file:

    OTHER_FILES +=
    qml/*.qml

    and added in my .qrc (resource) file:

    <RCC>
    <qresource prefix="/qml">
    <file>main.qml</file>
    <file>Page1.qml</file>
    <file>Page1Form.ui.qml</file>
    </qresource>
    </RCC>

    Yet, when I try to run it, it gives error "dependent ..\LearningFirstStepsWithQML\Page1Form.ui.qml" does not exist. It is searching for Page1Form.ui.qml in root directory of project rather than qml subdirectory.

    I looked for examples code, but I find that they made similar change in .pro and .qrc file to create directory/subdirectory structure for qml files. But, obviously I am missing something to get above error.

    Thanks for any helpful comment/advice,
    Gopal


  • Moderators

    @Gopal-Krishna said in Creating directory and subdirectory structure for qml and C++ files:

    <RCC>
    <qresource prefix="/qml">
    <file>main.qml</file>
    <file>Page1.qml</file>
    <file>Page1Form.ui.qml</file>
    </qresource>
    </RCC>

    should be either:

    <RCC>
    <qresource prefix="/qml">
    <file alias="main.qml">qml/main.qml</file>
    <file alias="Page1.qml">qml/Page1.qml</file>
    <file alias="Page1Form.ui.qml">qml/Page1Form.ui.qml</file>
    </qresource>
    </RCC>
    

    or

    <RCC>
    <qresource prefix="/">
    <file>qml/main.qml</file>
    <file>qml/Page1.qml</file>
    <file>qml/Page1Form.ui.qml</file>
    </qresource>
    </RCC>
    

    the path between the <file> tags always needs to be relative to the qrc file.


Log in to reply
 

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