Qt安装程序框架:从卸载程序中删除单选按钮

mar*_*rco 8 qt uninstallation qt-installer

我为我们的产品创建了一个简单的安装程序,只有一个组件,没有远程存储库管理器.

当我启动卸载程序时,介绍页面显示3个单选按钮:

  • 包经理

  • 更新组件

  • 删除所有组件

我只需要第三个,所以我检查了这个文档:

http://doc-snapshot.qt-project.org/qtifw-master/noninteractive.html

正如我已经理解并且无法隐藏按钮,我将其添加到我的install.qs文件中:

function Controller()
{
}

Controller.prototype.IntroductionPageCallback = function()
{
    gui.clickButton(buttons.NextButton);
}
Run Code Online (Sandbox Code Playgroud)

这应该在介绍页面上自动单击"下一步",以便它直接进入卸载页面.

什么都没发生,我在Controller功能中编写的内容,介绍页面显示了3个单选按钮.我在函数中添加了一些消息框,它们从未被调用过.

有人知道怎么解决吗?

MBa*_*ach 6

我想我有2种有效的解决方案。

第一种解决方案,如果要使用一个页面卸载程序:

您需要创建一个与之前启动的控制器类似的控制器

function Controller() {
    if (installer.isUninstaller()) {
        installer.setDefaultPageVisible(QInstaller.Introduction, false);
        installer.setDefaultPageVisible(QInstaller.ComponentSelection, false);
        installer.setDefaultPageVisible(QInstaller.LicenseCheck, false);
    }
}
Run Code Online (Sandbox Code Playgroud)

这将禁用经典安装/卸载工作流程中的所有页面。确保检查您是否处于卸载模式。

如果您需要2页的卸载程序:

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;
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

奖金

在安装程序模式下,默认情况下选择“我接受”许可协议。说真的,谁不呢?

Controller.prototype.LicenseAgreementPageCallback = function()
{
    var widget = gui.currentPageWidget();
    if (widget != null) {
        widget.AcceptLicenseRadioButton.checked = true;
    }
}
Run Code Online (Sandbox Code Playgroud)

  • 您将必须使用<ControlScript> controlScript.qs </ ControlScript>将脚本添加到config.xml中。 (2认同)