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. How to import an execution file into a Qt application?
Servers for Qt installer are currently down

How to import an execution file into a Qt application?

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 4 Posters 1.1k Views 2 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.
  • K Offline
    K Offline
    Kien Bui
    wrote on 7 Jun 2018, 11:22 last edited by
    #1

    I have an execution file.
    I want to import/attach/include,...(I don't know exactly) this file to project.
    After build. I have a Qt application.
    The first run Qt app, the an execution file export to path of Qt app.
    How to do this?

    R 1 Reply Last reply 7 Jun 2018, 11:36
    0
    • K Kien Bui
      7 Jun 2018, 11:22

      I have an execution file.
      I want to import/attach/include,...(I don't know exactly) this file to project.
      After build. I have a Qt application.
      The first run Qt app, the an execution file export to path of Qt app.
      How to do this?

      R Offline
      R Offline
      raven-worx
      Moderators
      wrote on 7 Jun 2018, 11:36 last edited by
      #2

      @Kien-Bui
      even this isn't by far not very nice, but since u asked for:

      put the executable into a qrc file and write it out:

      QFile in(":/my/executable");
      in.open( QFile::ReadOnly );
      
      QFile out( QCoreApplication::applicationDirPath() % QString("/executableName") ); // next to the application executable
      out.open( QFile::WriteOnly );
      
      out.write( in.readAll() );
      out.close();
      in.close();
      

      But you are advised to better distribute it along with your application, instead of embedding it with qrc.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      K 1 Reply Last reply 7 Jun 2018, 15:40
      4
      • R raven-worx
        7 Jun 2018, 11:36

        @Kien-Bui
        even this isn't by far not very nice, but since u asked for:

        put the executable into a qrc file and write it out:

        QFile in(":/my/executable");
        in.open( QFile::ReadOnly );
        
        QFile out( QCoreApplication::applicationDirPath() % QString("/executableName") ); // next to the application executable
        out.open( QFile::WriteOnly );
        
        out.write( in.readAll() );
        out.close();
        in.close();
        

        But you are advised to better distribute it along with your application, instead of embedding it with qrc.

        K Offline
        K Offline
        Kien Bui
        wrote on 7 Jun 2018, 15:40 last edited by
        #3

        @raven-worx said in How to import an execution file into a Qt application?:

        But you are advised to better distribute it along with your application, instead of embedding it with qrc.

        Because my Qt app need exec a process with that file. Another way is compressed two files into a zip file.
        I don't have better solution for this.

        J 1 Reply Last reply 7 Jun 2018, 16:00
        0
        • K Kien Bui
          7 Jun 2018, 15:40

          @raven-worx said in How to import an execution file into a Qt application?:

          But you are advised to better distribute it along with your application, instead of embedding it with qrc.

          Because my Qt app need exec a process with that file. Another way is compressed two files into a zip file.
          I don't have better solution for this.

          J Offline
          J Offline
          JonB
          wrote on 7 Jun 2018, 16:00 last edited by JonB 6 Jul 2018, 16:01
          #4

          @Kien-Bui

          Because my Qt app need exec a process with that file.

          Don't understand what the relevance of that is. @raven-worx is suggesting that distributing the executable(s) as separate files is a better idea than embedding them into your executable with qrc and extracting them. And I agree with him. The fact that you will need to "exec a process with that file" has no bearing on how you distribute it, separately or embedded.

          K 1 Reply Last reply 7 Jun 2018, 16:15
          2
          • J JonB
            7 Jun 2018, 16:00

            @Kien-Bui

            Because my Qt app need exec a process with that file.

            Don't understand what the relevance of that is. @raven-worx is suggesting that distributing the executable(s) as separate files is a better idea than embedding them into your executable with qrc and extracting them. And I agree with him. The fact that you will need to "exec a process with that file" has no bearing on how you distribute it, separately or embedded.

            K Offline
            K Offline
            Kien Bui
            wrote on 7 Jun 2018, 16:15 last edited by
            #5

            @JonB seperate. OK I will try with qrc. Tks

            M 1 Reply Last reply 7 Jun 2018, 16:27
            0
            • K Kien Bui
              7 Jun 2018, 16:15

              @JonB seperate. OK I will try with qrc. Tks

              M Offline
              M Offline
              mrjj
              Lifetime Qt Champion
              wrote on 7 Jun 2018, 16:27 last edited by
              #6

              @Kien-Bui
              Just as note. embedding it and save to file to execute them might trigger a
              heuristics scanner the user might be using. (Avast does)
              Might not be issue in your case, but just be aware of it. :)

              1 Reply Last reply
              3

              1/6

              7 Jun 2018, 11:22

              • Login

              • Login or register to search.
              1 out of 6
              • First post
                1/6
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved