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 create a .qs file
Forum Updated to NodeBB v4.3 + New Features

How to create a .qs file

Scheduled Pinned Locked Moved Unsolved General and Desktop
29 Posts 5 Posters 13.4k 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.
  • tomyT tomy

    Thank you for the answer.

    My config.xml is the same as the Docs:

    <?xml version="1.0" encoding="UTF-8"?>
    -<Installer>
    <Name>Qt Calculator</Name>
    <Version>1.4.0</Version>
    <Title>Qt Framework Installer</Title>
    <Publisher>Abbasi</Publisher>
    <StartMenuDir>Super App</StartMenuDir>
    <TargetDir>@HomeDir@/InstallationDirectory</TargetDir>
    </Installer>
    

    In the package.xml apparently I also need a .ui file. (pageform.ui):

    <?xml version="1.0" encoding="UTF-8"?>
    -<Package>
    <DisplayName>Qt Calculator</DisplayName>
    <Description>A Calculator Written in Qt by Purely C++ Code</Description>
    <Version>1.4</Version>
    <ReleaseDate>2017-07-17</ReleaseDate>
    <Name>com.vendor.root</Name>
    -<Licenses>
    <License file="License.txt" name="Beer Public License Agreement"/>
    </Licenses>
    <Virtual>false</Virtual>
    <Default>true</Default>
    <Script>installscript.qs</Script>
    -<UserInterfaces>
    <UserInterface>pageform.ui</UserInterface>
    </UserInterfaces>
    </Package>
    

    In the Docs, it says: In installscript.qs, we use the Component() function. But while I still don't have such a file how can write into it!!? My program still lacks it.

    I then switched to the resource directory (the data folder) by CMD and ran this command (as in the Dos):

    C:\Users\Abbasi\Desktop\package_directory\packages\com.vendor.product\data> C:\Qt\QtIFW2.0.1\bin\binarycreator.exe -c C:\Users\Abbasi\Desktop\package_directory\config\config.xml -p C:\Users\Abbasi\Desktop\package_directory\packages Qt_Calculator.exe

    I got some errors.

    seems to be a script file

    Yes it is a script file, and my question is how to have such a file please?

    mrjjM Offline
    mrjjM Offline
    mrjj
    Lifetime Qt Champion
    wrote on last edited by
    #5

    @tomy said in How to create a .qs file:

    Yes it is a script file, and my question is how to have such a file please?

    Have you tried Just to create a new empty file and renamed it to installscript.qs ?

    tomyT 1 Reply Last reply
    2
    • tomyT Offline
      tomyT Offline
      tomy
      wrote on last edited by tomy
      #6

      @koahnig

      I had used one of the example section as delivered with QTIFW. There is already a newer version QtIFW 2.0.5 available. There are a couple of different of installscript.qs there.

      I searched for that 2.0.5 for my Windows but didn't find, instead I downloaded qt-installer-framework-opensource-2.0.5-src and could find many installscript.qs files. I picked one plus an empty .ui file and named it to pageform. It's empty.
      for the installscript.qs I put the code below into it after clearing its previous data.

      function Component()
      {
          // Install to @RootDir@ instead of @HomeDir@ on Windows
          if (installer.value("os") === "win") {
              var homeDir = installer.value("HomeDir");
              var targetDir = installer.value("TargetDir").replace(homeDir, "@RootDir@");
              installer.setValue("TargetDir", targetDir);
          }
      
          // do not show component selection page
          installer.setDefaultPageVisible(QInstaller.ComponentSelection, false);
          // no startmenu entry so no need to ask where to create it
          installer.setDefaultPageVisible(QInstaller.StartMenuSelection, false);
      }
      

      Now seemingly I have all needed stuffs. I re-ran the command in a CMD and again got errors! :(

      Also this is a user forum. You are hardly getting repsonses on issues with Qt IFW.

      Dont' millions of programmers create installers for their apps? Is there any simpler and easier means to create installers for our apps. If someone writes a code, they are more eager to create an installer for that, I suppose.

      1 Reply Last reply
      0
      • mrjjM mrjj

        @tomy said in How to create a .qs file:

        Yes it is a script file, and my question is how to have such a file please?

        Have you tried Just to create a new empty file and renamed it to installscript.qs ?

        tomyT Offline
        tomyT Offline
        tomy
        wrote on last edited by
        #7

        @mrjj

        Have you tried Just to create a new empty file and renamed it to installscript.qs?

        Not honestly. But how to? What Project or Classes on Qt Creator IDE?

        mrjjM 1 Reply Last reply
        0
        • tomyT tomy

          @mrjj

          Have you tried Just to create a new empty file and renamed it to installscript.qs?

          Not honestly. But how to? What Project or Classes on Qt Creator IDE?

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by mrjj
          #8

          @tomy
          Just right click and create a text file then rename it. ( in your installer project folder)
          Its just a text file type and you add the commands manually.
          Seems to be nothing special you need to do.

          tomyT 1 Reply Last reply
          4
          • mrjjM mrjj

            @tomy
            Just right click and create a text file then rename it. ( in your installer project folder)
            Its just a text file type and you add the commands manually.
            Seems to be nothing special you need to do.

            tomyT Offline
            tomyT Offline
            tomy
            wrote on last edited by tomy
            #9

            @mrjj
            Very nifty mrjj. Thanks. :)

            And now what next, please?
            Some points in my mind:

            • Is the command I use (in CMD) correct?
            • Is it acceptable even if the pageform.ui file has nothing special?
            mrjjM 1 Reply Last reply
            1
            • tomyT tomy

              @mrjj
              Very nifty mrjj. Thanks. :)

              And now what next, please?
              Some points in my mind:

              • Is the command I use (in CMD) correct?
              • Is it acceptable even if the pageform.ui file has nothing special?
              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #10

              @tomy
              Hi
              Ï have never used the installer framework so I cant tell.
              Did you try the simple example
              http://doc.qt.io/qtinstallerframework/ifw-tutorial.html
              to get to know it ?

              1 Reply Last reply
              0
              • tomyT Offline
                tomyT Offline
                tomy
                wrote on last edited by
                #11

                Hi,
                Yeah, I used it. There should be some issue in paths in my stuff. :(

                mrjjM 1 Reply Last reply
                1
                • tomyT tomy

                  Hi,
                  Yeah, I used it. There should be some issue in paths in my stuff. :(

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #12

                  @tomy
                  with spaces or what kind of issues?

                  1 Reply Last reply
                  0
                  • tomyT Offline
                    tomyT Offline
                    tomy
                    wrote on last edited by
                    #13

                    Please take a look at this:
                    https://postimg.org/image/kaf5gm31t/

                    mrjjM 1 Reply Last reply
                    0
                    • tomyT tomy

                      Please take a look at this:
                      https://postimg.org/image/kaf5gm31t/

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #14

                      @tomy
                      Oh, there is something in the files it dont like. it seems.

                      When you tried the example , no errors were displayed?

                      tomyT 1 Reply Last reply
                      1
                      • mrjjM mrjj

                        @tomy
                        Oh, there is something in the files it dont like. it seems.

                        When you tried the example , no errors were displayed?

                        tomyT Offline
                        tomyT Offline
                        tomy
                        wrote on last edited by
                        #15

                        @mrjj
                        The code is of months ago but the Qt_Calculator.exe of Release mode now works fine in the data folder.
                        I think the problem is of either installscript.qs file or pageform.ui file. :(

                        mrjjM 1 Reply Last reply
                        0
                        • tomyT tomy

                          @mrjj
                          The code is of months ago but the Qt_Calculator.exe of Release mode now works fine in the data folder.
                          I think the problem is of either installscript.qs file or pageform.ui file. :(

                          mrjjM Offline
                          mrjjM Offline
                          mrjj
                          Lifetime Qt Champion
                          wrote on last edited by
                          #16

                          @tomy
                          But the errors seems to point to package.xml ?

                          1 Reply Last reply
                          1
                          • tomyT Offline
                            tomyT Offline
                            tomy
                            wrote on last edited by tomy
                            #17

                            This is the contents of that file:
                            https://postimg.org/image/hsuszqcel/

                            I see nothing clearly wrong in it.

                            mrjjM 1 Reply Last reply
                            0
                            • tomyT tomy

                              This is the contents of that file:
                              https://postimg.org/image/hsuszqcel/

                              I see nothing clearly wrong in it.

                              mrjjM Offline
                              mrjjM Offline
                              mrjj
                              Lifetime Qt Champion
                              wrote on last edited by
                              #18

                              @tomy
                              well the errors says it wont use name, but i fail to see the "meta" it talks about.
                              It also says the default and virtual should not be used together so maybe try to remove one?

                              tomyT 1 Reply Last reply
                              1
                              • mrjjM mrjj

                                @tomy
                                well the errors says it wont use name, but i fail to see the "meta" it talks about.
                                It also says the default and virtual should not be used together so maybe try to remove one?

                                tomyT Offline
                                tomyT Offline
                                tomy
                                wrote on last edited by
                                #19

                                @mrjj
                                Well it worked, not completely although. :)

                                I removed that virtual line in the package.xml. And it is in the meta folder. Please look:
                                https://postimg.org/image/u84mw60p9/

                                Then re-done the command. It again returned some issues:
                                https://postimg.org/image/y1wdy7ihz/

                                It finally created an installer in the Result folder on desktop. But It doesn't put a shortcut of the program on desktop, and it's the contents of the installation folder:
                                https://postimg.org/image/kvdfu4zcb/

                                I think now I should somehow change the contents of installscript.qs file.

                                mrjjM 1 Reply Last reply
                                0
                                • tomyT tomy

                                  @mrjj
                                  Well it worked, not completely although. :)

                                  I removed that virtual line in the package.xml. And it is in the meta folder. Please look:
                                  https://postimg.org/image/u84mw60p9/

                                  Then re-done the command. It again returned some issues:
                                  https://postimg.org/image/y1wdy7ihz/

                                  It finally created an installer in the Result folder on desktop. But It doesn't put a shortcut of the program on desktop, and it's the contents of the installation folder:
                                  https://postimg.org/image/kvdfu4zcb/

                                  I think now I should somehow change the contents of installscript.qs file.

                                  mrjjM Offline
                                  mrjjM Offline
                                  mrjj
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #20

                                  @tomy
                                  Yes the installscript.qs should contain the actual
                                  code to execute while installing.

                                  1 Reply Last reply
                                  1
                                  • tomyT Offline
                                    tomyT Offline
                                    tomy
                                    wrote on last edited by tomy
                                    #21

                                    Yes, it seems to be the last important issue on the app. How to change it to work fine, please?
                                    This is its code:

                                    function Component()
                                    {
                                        // Install to @RootDir@ instead of @HomeDir@ on Windows
                                        if (installer.value("os") === "win") {
                                            var homeDir = installer.value("HomeDir");
                                            var targetDir = installer.value("TargetDir").replace(homeDir, "@RootDir@");
                                            installer.setValue("TargetDir", targetDir);
                                        }
                                    
                                        // do not show component selection page
                                        installer.setDefaultPageVisible(QInstaller.ComponentSelection, false);
                                        // no startmenu entry so no need to ask where to create it
                                        installer.setDefaultPageVisible(QInstaller.StartMenuSelection, false);
                                    }
                                    
                                    mrjjM 1 Reply Last reply
                                    0
                                    • tomyT tomy

                                      Yes, it seems to be the last important issue on the app. How to change it to work fine, please?
                                      This is its code:

                                      function Component()
                                      {
                                          // Install to @RootDir@ instead of @HomeDir@ on Windows
                                          if (installer.value("os") === "win") {
                                              var homeDir = installer.value("HomeDir");
                                              var targetDir = installer.value("TargetDir").replace(homeDir, "@RootDir@");
                                              installer.setValue("TargetDir", targetDir);
                                          }
                                      
                                          // do not show component selection page
                                          installer.setDefaultPageVisible(QInstaller.ComponentSelection, false);
                                          // no startmenu entry so no need to ask where to create it
                                          installer.setDefaultPageVisible(QInstaller.StartMenuSelection, false);
                                      }
                                      
                                      mrjjM Offline
                                      mrjjM Offline
                                      mrjj
                                      Lifetime Qt Champion
                                      wrote on last edited by
                                      #22

                                      @tomy
                                      That i dont know
                                      It seems to be commands from
                                      http://doc.qt.io/qtinstallerframework/scripting.html

                                      So you will also need some copy commands from ( i think)
                                      http://doc.qt.io/qtinstallerframework/operations.html

                                      1 Reply Last reply
                                      2
                                      • tomyT Offline
                                        tomyT Offline
                                        tomy
                                        wrote on last edited by
                                        #23

                                        OK, mate. I will read both posts precisely and will post again to you here about the results.

                                        1 Reply Last reply
                                        1
                                        • tomyT Offline
                                          tomyT Offline
                                          tomy
                                          wrote on last edited by
                                          #24

                                          I read the pages and changed the installscript.qs to this:

                                          function Component()
                                          {
                                              if (installer.value("os") === "win")
                                                {
                                                   installer.setValue("ApplicationsDir", "ApplicationsDir");
                                                   component.addOperation("CreateShortcut",
                                                   "@DesktopDir@/Qt_Calculator.exe", "@StartMenuDir@/Qt_Calculator.lnk");
                                                }
                                          }
                                          

                                          My purposes were to first make the app be installed in C:\ProgramFiles folder and then to have a shortcut of the app on my Desktop.
                                          The data folder contains a Qt_Calculator.icon file. These are all contents of that folder:
                                          https://postimg.org/image/f3fddnww5/

                                          Then I again used this command:
                                          C:\Users\Abbasi\Desktop\package_directory\packages\com.vendor.product\data> C:\Qt\QtIFW2.0.1\bin\binarycreator.exe -c C:\Users\Abbasi\Desktop\package_directory\config\config.xml -p C:\Users\Abbasi\Desktop\package_directory\packages C:\Users\Abbasi\Desktop\Result\Qt_Calculator.exe

                                          I got an error and a warning as below:
                                          https://postimg.org/image/w6p5ajr25/

                                          At the end, it created the installer but it works this way:
                                          It creates an installer file in the Result folder and have the default path of C:\Users\Abbasi for installation and after installing it creates no shourcut on the Desktop.

                                          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