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?
Forum Updated to NodeBB v4.3 + New Features

Add QML file NOT in resource file. How?

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 3 Posters 822 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 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.HilkJ 1 Reply Last reply
    0
    • B bogong

      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.HilkJ Online
      J.HilkJ Online
      J.Hilk
      Moderators
      wrote on 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
      0
      • J.HilkJ J.Hilk

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

        B Offline
        B Offline
        bogong
        wrote on 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.HilkJ 1 Reply Last reply
        0
        • B bogong

          @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.HilkJ Online
          J.HilkJ Online
          J.Hilk
          Moderators
          wrote on 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
          0
          • J.HilkJ J.Hilk

            @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 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
            • fcarneyF Offline
              fcarneyF Offline
              fcarney
              wrote on 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
              0
              • fcarneyF fcarney

                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 last edited by
                #7

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

                J.HilkJ 1 Reply Last reply
                0
                • B bogong

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

                  J.HilkJ Online
                  J.HilkJ Online
                  J.Hilk
                  Moderators
                  wrote on 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
                  0
                  • J.HilkJ J.Hilk

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