Qt installer framework: remove radio buttons from uninstaller

前端 未结 1 827
眼角桃花
眼角桃花 2021-01-02 14:00

I have created a simple installer for our product with only 1 component and no remote repositories manager.

When I start the uninstaller, the introduction page shows

相关标签:
1条回答
  • 2021-01-02 14:12

    I think I have 2 working solutions.

    First solution, if you want to have a single page uninstaller:

    You need to create a Controller like the one you started before:

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

    This will disable all pages in the classic install/uninstall workflow. Make sure to check you're in uninstall mode.

    If you want a 2 pages uninstaller:

    function Controller()
    {
    
    }
    
    Controller.prototype.IntroductionPageCallback = function()
    {
        if (installer.isUninstaller()) {
            // Get the current wizard page
            var widget = gui.currentPageWidget(); 
            if (widget != null) {
                // Don't show buttons because we just want to uninstall the software
                widget.findChild("PackageManagerRadioButton").visible = false;
                widget.findChild("UpdaterRadioButton").visible = false;
                widget.findChild("UninstallerRadioButton").visible = false;
            }
        }
    }
    

    Bonus

    In installer mode, select by default "I accept" the Licence Agreement. Seriously, who doesn't?

    Controller.prototype.LicenseAgreementPageCallback = function()
    {
        var widget = gui.currentPageWidget();
        if (widget != null) {
            widget.AcceptLicenseRadioButton.checked = true;
        }
    }
    
    0 讨论(0)
提交回复
热议问题