Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Creating directory and subdirectory structure for qml and C++ files
Forum Update on Monday, May 27th 2025

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

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 2.8k 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.
  • G Offline
    G Offline
    Gopal Krishna
    wrote on 23 Dec 2016, 08:07 last edited by
    #1

    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

    R 1 Reply Last reply 23 Dec 2016, 08:30
    0
    • G Gopal Krishna
      23 Dec 2016, 08:07

      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

      R Offline
      R Offline
      raven-worx
      Moderators
      wrote on 23 Dec 2016, 08:30 last edited by
      #2

      @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.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0

      1/2

      23 Dec 2016, 08:07

      • Login

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