Using "RegisterFileType" in Qt Installer Framework



  • I'm trying to create an installer that register a file extension. So I'm using the following commnad in my install script:

    @component.addOperation("RegisterFileType", "prp", "@TargetDir@/@ProductName@.exe");@

    But how can I provide the file being opened to my application? I didn't found anything in the "documentation":http://qt-project.org/doc/qtinstallerframework-1.5/operations.html



  • I also would like to know how to provide an icon. The "registerfileextension" example do this:

    @component.createOperations();
    var iconId = 0;
    var notepadPath = installer.environmentVariable("SystemRoot") + "\notepad.exe";

    var isRegisterFileChecked = component.userInterface("RegisterFileCheckBoxesForm").RegisterFileCheckBox.checked;
    if (installer.value("os") === "win") {
        component.addOperation("RegisterFileType",
                               component.unusalFileType,
                               notepadPath + " '%1'",
                               "QInstaller Framework example file type",
                               "text/plain",
                               notepadPath + "," + iconId,
                               "ProgId=QtProject.QtInstallerFramework." + component.unusalFileType);
    }
    component.addOperation("Move", "@TargetDir@/registeredfile", component.registeredFile);@
    

    But how can I provide my own ico file?



  • Ok. After digging a bit I found my answers.

    • How to provide the file being opened to the command in "RegisterFileType"?
    • '%1' like in the example above
    • How to provide an icon for the file being registered
    • The icon must be in "TargetDir" or it must be some default icon file.


  • Hi mcleary.
    Thank you for sharing this solution. It would be great if you add doc notes for that.



  • The registering works nicely for me with QtIFW 1.5, but is there a possibility to select my application as the DEFAULT application the file type is opened with? When an application has already registered the extension is stays the default application... :/



  • Thanks for this post and answer!

    Also interested in kiro's question.


Log in to reply
 

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