Creating start menu shortcut using Qt installer framework



  • I am trying to create shortcut of a folder in the start menu of my application using Qt-framework installer . I have used this code in my installscript.qs i am able to get the shortcut of it in my start menu ( as shown for notepad). Is it possible to get the folder for the same using installer framework ??? (shown for notepad )

    Component.prototype.createmenuOperations = function()
    {
        component.createOperations();
    
        if (systemInfo.productType === "windows") {
            component.addOperation("CreateShortcut", "@TargetDir@/App.exe", "@StartMenuDir@/App.lnk",
                "workingDirectory=@TargetDir@", "iconPath=@TargetDir@/App.ico");
        }
    }
    

    and i have also tried

    Component.prototype.createmenuOperations = function()
    {
        component.createOperations();
    
        if (systemInfo.productType === "windows") {
            component.addOperation("CreateShortcut", "@TargetDir@", "@StartMenuDir@/App.lnk",
                "workingDirectory=@TargetDir@", "iconPath=@TargetDir@/App.ico");
        }
    }
    


  • I have added these to my installscript.qs which creates a folder of my application .

    Component.prototype.createOperations = function()
    {
        try {
            // call the base create operations function
            component.createOperations();
            if (installer.value("os") == "win") { 
                try {
    component.addOperation("CreateShortcut", "@TargetDir@/App.exe", "@StartMenuDir@/App.lnk", "workingDirectory=@TargetDir@", "iconPath=@TargetDir@/App.ico");
                } catch (e) {
                    // Do nothing if key doesn't exist
                }
            }
        } catch (e) {
            print(e);
        
    
    		
    

  • Moderators

    @Ratzz
    Did this solve your issue?

    [edit: koahnig] Found the example in the installer framework and I am able to create shortcut now.



  • @koahnig
    Yes .


Log in to reply
 

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