How to create a .qs file
-
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 downloadedqt-installer-framework-opensource-2.0.5-src
and could find manyinstallscript.qs
files. I picked one plus an empty.ui
file and named it topageform
. It's empty.
for theinstallscript.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.
-
@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 ?
-
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?
-
@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. -
@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?
@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 ? -
Please take a look at this:
https://postimg.org/image/kaf5gm31t/ -
Please take a look at this:
https://postimg.org/image/kaf5gm31t/ -
@tomy
Oh, there is something in the files it dont like. it seems.When you tried the example , no errors were displayed?
-
@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. :( -
This is the contents of that file:
https://postimg.org/image/hsuszqcel/I see nothing clearly wrong in it.
-
This is the contents of that file:
https://postimg.org/image/hsuszqcel/I see nothing clearly wrong in it.
-
@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?@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.
-
@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.
-
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); }
-
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); }
@tomy
That i dont know
It seems to be commands from
http://doc.qt.io/qtinstallerframework/scripting.htmlSo you will also need some copy commands from ( i think)
http://doc.qt.io/qtinstallerframework/operations.html -
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.exeI 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. -
@tomy
I used thisComponent.prototype.createOperations = function() { try { // call the base create operations function component.createOperations(); if (installer.value("os") == "win") { try { var userProfile = installer.environmentVariable("USERPROFILE"); installer.setValue("UserProfile", userProfile); component.addOperation("CreateShortcut", "@TargetDir@/MyApp.exe", "@UserProfile@/Desktop/MyApp.lnk" ,"workingDirectory=@TargetDir@", "iconPath=@TargetDir@/MyApp.ico"); component.addOperation("CreateShortcut", "@TargetDir@/MyApp.exe", "@TargetDir@/MyApp.lnk" ,"workingDirectory=@TargetDir@", "iconPath=@TargetDir@/MyApp.ico"); component.addOperation("CreateShortcut", "@TargetDir@/MyApp.exe", "@StartMenuDir@/MyApp.lnk", "workingDirectory=@TargetDir@", "iconPath=@TargetDir@/MyApp.ico"); } catch (e) { // Do nothing if key doesn't exist } } } catch (e) { print(e); } }