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



  • My code:

    Component.prototype.createOperations = function()
    {
    	component.createOperations();
    
    	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?


  • Moderators

    @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@");
    

  • Moderators

    @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
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.