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. Add QML file NOT in resource file. How?

Add QML file NOT in resource file. How?

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 3 Posters 753 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.
  • B Offline
    B Offline
    bogong
    wrote on 19 Aug 2020, 07:26 last edited by bogong
    #1

    Hello!

    I've got forgotten how to add QML file into *.pro file directly without resources. I remember only this - there are need to be added something special that will deploy QML files to the distribution folder. Could someone refresh my memory?

    For now I am adding it through Qt Creator interface, but it's not deploying on device when building it.

    What am I missing?

    J 1 Reply Last reply 19 Aug 2020, 07:44
    0
    • B bogong
      19 Aug 2020, 07:26

      Hello!

      I've got forgotten how to add QML file into *.pro file directly without resources. I remember only this - there are need to be added something special that will deploy QML files to the distribution folder. Could someone refresh my memory?

      For now I am adding it through Qt Creator interface, but it's not deploying on device when building it.

      What am I missing?

      J Offline
      J Offline
      J.Hilk
      Moderators
      wrote on 19 Aug 2020, 07:44 last edited by
      #2

      @bogong
      DISTFILES iirc
      https://doc.qt.io/qt-5/qmake-variable-reference.html#distfiles


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      B 1 Reply Last reply 19 Aug 2020, 07:48
      0
      • J J.Hilk
        19 Aug 2020, 07:44

        @bogong
        DISTFILES iirc
        https://doc.qt.io/qt-5/qmake-variable-reference.html#distfiles

        B Offline
        B Offline
        bogong
        wrote on 19 Aug 2020, 07:48 last edited by bogong
        #3

        @J-Hilk It's ignored. I don't know why.

        Screenshot 2020-08-19 at 10.48.30.png

        It's the first thing that I've checked.

        J 1 Reply Last reply 19 Aug 2020, 07:54
        0
        • B bogong
          19 Aug 2020, 07:48

          @J-Hilk It's ignored. I don't know why.

          Screenshot 2020-08-19 at 10.48.30.png

          It's the first thing that I've checked.

          J Offline
          J Offline
          J.Hilk
          Moderators
          wrote on 19 Aug 2020, 07:54 last edited by
          #4

          @bogong It says in the documentation, thats its for UnixMake specs only, I assume thats the issue 🤔

          I don't know, the other idea I have would be a QMake_POST_LINK export, that copies all files after compilation


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          B 1 Reply Last reply 19 Aug 2020, 08:06
          0
          • J J.Hilk
            19 Aug 2020, 07:54

            @bogong It says in the documentation, thats its for UnixMake specs only, I assume thats the issue 🤔

            I don't know, the other idea I have would be a QMake_POST_LINK export, that copies all files after compilation

            B Offline
            B Offline
            bogong
            wrote on 19 Aug 2020, 08:06 last edited by bogong
            #5

            @J-Hilk Now I have this

            Screenshot 2020-08-19 at 11.05.25.png

            Never been having this kind of troubles in any project

            Screenshot 2020-08-19 at 11.09.55.png

            1 Reply Last reply
            0
            • F Offline
              F Offline
              fcarney
              wrote on 19 Aug 2020, 14:51 last edited by
              #6

              In order to copy files we have a build step like this:

              templates.path = $$INSTALL_BASE
              templates.files = \
                   ../file.txt \
                   ../file2.txt
              INSTALLS += templates
              

              You will have to figure out the correct paths though. I believe "templates" is a name you can choose.

              C++ is a perfectly valid school of magic.

              B 1 Reply Last reply 27 Aug 2020, 09:57
              0
              • F fcarney
                19 Aug 2020, 14:51

                In order to copy files we have a build step like this:

                templates.path = $$INSTALL_BASE
                templates.files = \
                     ../file.txt \
                     ../file2.txt
                INSTALLS += templates
                

                You will have to figure out the correct paths though. I believe "templates" is a name you can choose.

                B Offline
                B Offline
                bogong
                wrote on 27 Aug 2020, 09:57 last edited by
                #7

                @fcarney It's not working. Still ignoring copying files totally.

                J 1 Reply Last reply 27 Aug 2020, 10:33
                0
                • B bogong
                  27 Aug 2020, 09:57

                  @fcarney It's not working. Still ignoring copying files totally.

                  J Offline
                  J Offline
                  J.Hilk
                  Moderators
                  wrote on 27 Aug 2020, 10:33 last edited by
                  #8

                  @bogong

                  defineTest(copyToDestDir) {
                      files = $$1
                      dir = $$2
                      # replace slashes in destination path for Windows
                      win32:dir ~= s,/,\\,g
                  
                      for(file, files) {
                          # replace slashes in source path for Windows
                          win32:file ~= s,/,\\,g
                  
                          QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$shell_quote($$file) $$shell_quote($$dir) $$escape_expand(\\n\\t)
                      }
                  
                      export(QMAKE_POST_LINK)
                  }
                  
                  copyToDestDir(sourceFolder, destination)
                  

                  Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                  Q: What's that?
                  A: It's blue light.
                  Q: What does it do?
                  A: It turns blue.

                  B 1 Reply Last reply 29 Aug 2020, 17:59
                  0
                  • J J.Hilk
                    27 Aug 2020, 10:33

                    @bogong

                    defineTest(copyToDestDir) {
                        files = $$1
                        dir = $$2
                        # replace slashes in destination path for Windows
                        win32:dir ~= s,/,\\,g
                    
                        for(file, files) {
                            # replace slashes in source path for Windows
                            win32:file ~= s,/,\\,g
                    
                            QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$shell_quote($$file) $$shell_quote($$dir) $$escape_expand(\\n\\t)
                        }
                    
                        export(QMAKE_POST_LINK)
                    }
                    
                    copyToDestDir(sourceFolder, destination)
                    
                    B Offline
                    B Offline
                    bogong
                    wrote on 29 Aug 2020, 17:59 last edited by bogong
                    #9

                    @J-Hilk Everything ignored on MacOS. I really don't know what is going on. It's DO NOT copying any files. I just need to add *.qml files to the project without resource files, directly. Nothing more.

                    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