Start Menu Shortcut Example

Start Menu illustrates how to use the Component function to add an entry for opening a README file to the Windows Start menu.
<?xml version="1.0" encoding="UTF-8"?>
<Installer>
<Name>Start Menu Shortcut Example</Name>
<Version>1.0.0</Version>
<Title>Start Menu Shortcut Example</Title>
<Publisher>Qt-Project</Publisher>
<StartMenuDir>Qt Installer Framework Examples</StartMenuDir>
<TargetDir>@HomeDir@/IfwExamples/startmenu</TargetDir>
</Installer>
- The
<Default>element is set totrueto preselect the component in the installer. - The
<Script>element specifies the file name of the JavaScript file that is loaded to perform operations.
<?xml version="1.0" encoding="UTF-8"?>
<Package>
<DisplayName>README.txt</DisplayName>
<Description>A README.txt, accessible through a start menu entry.</Description>
<Version>1.0.0-1</Version>
<ReleaseDate>2013-01-01</ReleaseDate>
<Default>true</Default>
<Script>installscript.qs</Script>
</Package>
Adding Entries to Start Menu
In installscript.qs, we use the createOperations() function to call the component::createOperations() function, which creates the Extract operation by default:
Component.prototype.createOperations = function()
{
component.createOperations();
On Windows, we use the component::addOperation function to add a shortcut to the Start menu for opening the readme file:
if (systemInfo.productType === "windows") {
component.addOperation("CreateShortcut", "@TargetDir@/README.txt", "@StartMenuDir@/README.lnk",
"workingDirectory=@TargetDir@", "iconPath=%SystemRoot%/system32/SHELL32.dll",
"iconId=2");
}
}
Files: