Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Working with QML files for iOS app
Forum Updated to NodeBB v4.3 + New Features

Working with QML files for iOS app

Scheduled Pinned Locked Moved Mobile and Embedded
ios
8 Posts 3 Posters 1.8k Views 3 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.
  • D Offline
    D Offline
    DRoscoe
    wrote on last edited by
    #1

    I have an app that has two modes. One is a "live" mode where data is provided from a server and the other is a "test" mode where no server is needed. Both modes use the same QML files, but currently, the QML files are in the "live" project and only get copied when the "live" project is built/installed.

    My question is, how can I organize my QML files so that both projects are ensured to have the files available in the iOS app bundle? I assume I should put the files in its own folder that is used by both, but how do I ensure they are copied into a predictable location within the resulting app bundle?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DRoscoe
      wrote on last edited by DRoscoe
      #2

      To clarify what I am trying to do, I have an xCode project that has to apps. Both apps share the same resource files. I want both apps to have access to them without having to copy them to two different places. For example

      Main
      Resources
           App1
              live_app.qrc
          App2
              standalone_app.qrc
      

      I want the two .qrc files to access the same Resources files a directory level or two above it. I already know if I copy the resources to a subdirectory inside each app, it will work, but I dont want to do this. I have tried many variations and have been unsuccessful getting the resources to be found if they are not in a subdirectory below the .grc file

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        AFAIK, qrc files can only work with files in the same folder and bellow. What about putting your qml files in another folder at the same level as App1 and App2 and then include it in both your project ? I haven't tested it though

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        D 1 Reply Last reply
        0
        • SGaistS SGaist

          Hi,

          AFAIK, qrc files can only work with files in the same folder and bellow. What about putting your qml files in another folder at the same level as App1 and App2 and then include it in both your project ? I haven't tested it though

          D Offline
          D Offline
          DRoscoe
          wrote on last edited by DRoscoe
          #4

          @SGaist One thought I had to get around this problem was to put the resources in a separate library and use the Qt Resource System to access the resources from the library. I can't think of a reason why it wouldn't work, do you?

          1 Reply Last reply
          0
          • benlauB Offline
            benlauB Offline
            benlau
            Qt Champions 2016
            wrote on last edited by
            #5

            @DRoscoe What if you give up to use relative path and create a package name of your shared code? Usually I will add "qrc:///" to import path. Then place the shared code at qrc:///PackageName/Xxx.qml . Then export those component via qmldir.

            D 1 Reply Last reply
            0
            • benlauB benlau

              @DRoscoe What if you give up to use relative path and create a package name of your shared code? Usually I will add "qrc:///" to import path. Then place the shared code at qrc:///PackageName/Xxx.qml . Then export those component via qmldir.

              D Offline
              D Offline
              DRoscoe
              wrote on last edited by
              #6

              @benlau That sounds promising. Would you be able to provide a small example of this process?

              benlauB 1 Reply Last reply
              0
              • D DRoscoe

                @benlau That sounds promising. Would you be able to provide a small example of this process?

                benlauB Offline
                benlauB Offline
                benlau
                Qt Champions 2016
                wrote on last edited by
                #7

                @DRoscoe

                Example qmldir
                quickios/qmldir at master · benlau/quickios

                Import the shared code ( import QuickIOS)
                quickios/AlertViewDemo.qml at master · benlau/quickios

                Add import path
                quickios/main.cpp at master · benlau/quickios

                D 1 Reply Last reply
                1
                • benlauB benlau

                  @DRoscoe

                  Example qmldir
                  quickios/qmldir at master · benlau/quickios

                  Import the shared code ( import QuickIOS)
                  quickios/AlertViewDemo.qml at master · benlau/quickios

                  Add import path
                  quickios/main.cpp at master · benlau/quickios

                  D Offline
                  D Offline
                  DRoscoe
                  wrote on last edited by
                  #8

                  @benlau Thanks for this example! Sorry for the late reply. I didn't see that you had responded.

                  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