Important: Please read the Qt Code of Conduct -

Qt Installer Framework. How to create shortcut on the Windows desktop?

  • My code:

    Component.prototype.createOperations = function()
    	if (systemInfo.productType === "windows") {
    			component.addOperation("CreateShortcut", "@TargetDir@/Constructor.exe", "@DesktopDir@/Конструктор.lnk", "iconPath=@TargetDir@/icn_constructor.ICO");				

    But sometimes i see this:
    alt text
    I guess this is because the icon was not in the @TargetDir@ when the shortcut was created. How to fix that?

  • @Sinbad

    Looks fine to me.

    The only differences I have with the code I am using is:
    a "workingDirectory" is also declared and the icon is already part of the exe and therefore loaded from the exe.

  • component.addOperation("CreateShortcut", "@TargetDir@/Constructor.exe", "@DesktopDir@/Конструктор.lnk", "workingDirectory=@TargetDir@");

  • @Sinbad

    That is apparently another possiblity.
    I have a duplication then with

    component.addOperation("CreateShortcut",  "@TargetDir@/Constructor.exe", "@DesktopDir@/Конструктор.lnk", "workingDirectory=@TargetDir@", "iconPath=@TargetDir@/Constructor.exe");

    for your case

  • Sometimes, it works. But somtimes i need to refresh the desktop to see app icons. Maybe it's beacouse I need to create 3 icons, not just one?

Log in to reply