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. [Resolved]add bundle resource to *.app , what is the relative path of "APP_QML_FILES.files"
Forum Updated to NodeBB v4.3 + New Features

[Resolved]add bundle resource to *.app , what is the relative path of "APP_QML_FILES.files"

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 2 Posters 1.8k 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.
  • W Offline
    W Offline
    wade-J
    wrote on last edited by
    #1

    I am building a qml project and add some javascript source files in "Other files"(generated by Qt Creator).
    These files is put in my folder named "jssrc/test.js".

    What I want to do is copy these files as bundle resource in to the .app, when the project is built.
    And I found the way in forum, like this:

    @
    APP_QML_FILES.files = /Users/jw/mycode/xcode/colorbox/colorbox/jssrc/test.js
    APP_QML_FILES.path = jssrc
    QMAKE_BUNDLE_DATA += APP_QML_FILES
    @

    But I have to use the full path "/Users/jw/mycode/xcode/colorbox/colorbox/jssrc/test.js".
    If I use "jssrc/test.js", it doesn't work.

    Two questions:
    (1)
    So what is the search path of the .pro file,and how can I use relative path?
    Why other flags ,which use relative path, works,such as:

    @
    OTHER_FILES +=
    jssrc/dropcoin.js
    jssrc/getcoin.js
    jssrc/platform-api.js
    jssrc/platform-colorbox.js
    jssrc/test.js
    @

    (2)
    If I want to add some other files such as image files, should I add these bundle files one by one in .pro file?
    Is there convenient or maybe smart way to do such thing automatically?

    Who can explain that to me in detail.
    Thanks in advance.

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Please try using $$PWD to automatically add the path to current dir.

      Qt offers the Qt Resource System "link":http://qt-project.org/doc/qt-5/resources.html. You can use it to store any number and type of files.

      (Z(:^

      1 Reply Last reply
      0
      • W Offline
        W Offline
        wade-J
        wrote on last edited by
        #3

        Thanks, sierdzio.
        I write the .pro like below and it works.

        @
        APP_QML_FILES.files = @PWD/jssrc/test.js
        APP_QML_FILES.path = jssrc
        QMAKE_BUNDLE_DATA += APP_QML_FILES
        @

        I did use qrc system and now I am trying dynamically load file.
        Your link does help, thanks a lot.

        Another question , where can I find the pre-defined Macro in .pro,like PWD, QMAKE_BUNDLE_DATA, and so on ?
        Can you give me the link please?

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          All the ones that Qt decided to make official are listed in the documentation: "qmake variable reference":http://qt-project.org/doc/qt-5/qmake-variable-reference.html. This is not all qmake can do, there are also built-in functions and conditionals (all in the docs). You can also make system calls in .pro files, but that is - obviously - platform-dependent.

          And apart from that all, qmake has a lot of undocumented features. Some of them can be very useful, but since they are not documented, they are also not officially supported and can be changed or removed between releases - without any warning. You would have to dig a bit to find them (try Googling "undocumented qmake" if you are curious).

          (Z(:^

          1 Reply Last reply
          0
          • W Offline
            W Offline
            wade-J
            wrote on last edited by
            #5

            Thanks ,sierdzio. ; )

            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