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. Directorys are shown twice in qrc path
Forum Updated to NodeBB v4.3 + New Features

Directorys are shown twice in qrc path

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 2 Posters 1.4k 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.
  • H Offline
    H Offline
    Hawk30100
    wrote on last edited by
    #1

    Hello dear community,

    In my application I am only using the qrc file system.

    This is my approach:

    1. I create a directory structure in my windows file system for my Qt Creator project.

    @AndroidQtApplication

    • /qml
      • /navigation
      • /settings@
    1. Then I create a new qml file and save it under the path "/qml/navigation" on my windows file system.
      I also want to have this windows file system structure in my Qt Creator project.
      Therefore I create a prefix for every directory in my windows file system structure

    @Resource Files

    • qml.src
      • /navigation
      • /settings@
    1. Add an existing qml file to the qrc file system.
      And here is the problem! The path to the file will be shown as below.

    @Resource Files

    • qml.src
      • /navigation
        • qml/navigation/navigationOverview.qml
      • /settings@

    If I want to use that file in another qml file I have to use this path:
    @... source: "qrc:///navigation/qml/navigation/navigationOverview.qml@

    What I want is only to write down the qrc file system path (without the windows file system path!):
    @... source: "qrc:///navigation/navigationOverview.qml@

    And the end I will have some paths like this:
    @... source: "qrc:///navigation/settings/overview/qml/navigation/settings/overview/navigationSettingsOverview.qml"@
    this really sucks..

    So the question is now: How can I achieve this?
    (Maybe I didn't understand how the qrc file system works?)

    Thanks for your answers!

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      It is going to take the entire path like this. It is creating the relative path from the current directory in qrc. Assumption is that you would like continue the path structure you have put starting from your project location. It is like package system. If you don't want this kind of entire path, you can put the qmls in different directory and add them in QRC files.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      0
      • H Offline
        H Offline
        Hawk30100
        wrote on last edited by
        #3

        Thanks for your fast reply!

        Unfortunately I dont understand excatly what you mean with:
        [quote author="Dheerendra" date="1408694784"]If you don't want this kind of entire path, you can put the qmls in different directory and add them in QRC files. [/quote]

        I thought I was already doing this?
        I just saved the qml files in different directorys on my windows and added them into one qrc-file. (And created a prefix for every directory on my windows)

        1 Reply Last reply
        0
        • dheerendraD Offline
          dheerendraD Offline
          dheerendra
          Qt Champions 2022
          wrote on last edited by
          #4

          When you are adding the file, it takes the path from the current source directory.

          Here is documentation from Qt Resource file system.
          "The specified paths are relative to the directory containing the .qrc file. Note that the listed resource files must be located in the same directory as the .qrc file, or one of its subdirectories"

          If you don't want this relative path in QRC file, you can remove the entire path and keep only required file. Just open the QRC file in Qt creator->RightClick->Rename. Now you can remove the path you don't want.

          Hope this helps.

          Dheerendra
          @Community Service
          Certified Qt Specialist
          http://www.pthinks.com

          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