Qt Installer: show uninstall window only

Qt Installer Framework is the multiplatform installer solution provided by Qt team. Is a powerful tool but customization is currently not so easy cause no visual tool has been provided and all the customizations have to be done by code.



In this post will analyze the uninstall phase. When the user ask for unistallation of a software previously installed using this too the default window showed is the following (the picture show the standard Qt installer tool just for example):


However if you software does not provide manage update components but only uninstall this will have a result that the first two options will not work and only the third will have some effect. This will appear confusing for the user and also a bit unprofessional. Fortunately change for bypass this window and directly show the uninstall windows is quite easy. Basically you have to add a script into the main config.xml as follow (config.xml is the main configuration file of the Qt Installer Framework):

<?xml version="1.0" encoding="UTF-8"?>
<Installer>
    <Name>MySoftwareName</Name>
    <Version>1.0</Version>
    <Title>MySoftware</Title>
    <Publisher>FalsinSoft</Publisher>
    <StartMenuDir>MySoftware</StartMenuDir>
    <TargetDir>@ApplicationsDir@/MySoftware</TargetDir>
    <ControlScript>controlscript.qs</ControlScript>
</Installer>

The controlscript.qs file will contain only the following lines:

function Controller()
{
    if(installer.isUninstaller())
    {
        installer.setDefaultPageVisible(QInstaller.Introduction, false);
        installer.setDefaultPageVisible(QInstaller.ComponentSelection, false);
        installer.setDefaultPageVisible(QInstaller.LicenseCheck, false);
    }
}

Once recompiled your installer now when unistall action will be requested by the user the uninstall window will be showed immediately without any additional previous phase to select.

Comments

Popular posts from this blog

Access GPIO from Linux user space

Android: adb push and read-only file system error

Tree in SQL database: The Nested Set Model