9

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

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

  • 包管理器

  • 更新组件

  • 移除所有组件

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

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

据我了解并且无法隐藏按钮,我将其添加到我的 install.qs 文件中:

function Controller()
{
}

Controller.prototype.IntroductionPageCallback = function()
{
    gui.clickButton(buttons.NextButton);
}

这应该会自动单击介绍页面上的下一步,因此它应该直接转到卸载页面。

什么也没发生,无论我在 Controller 函数中写什么,介绍页面都会显示 3 个单选按钮。我在函数中添加了一些消息框,它们从未被调用。

有人知道如何解决吗?

4

1 回答 1

7

我想我有 2 个可行的解决方案。

第一个解决方案,如果您想要一个单页卸载程序:

您需要像之前开始的那样创建一个控制器:

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

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

如果你想要一个 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;
        }
    }
}

奖金

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

Controller.prototype.LicenseAgreementPageCallback = function()
{
    var widget = gui.currentPageWidget();
    if (widget != null) {
        widget.AcceptLicenseRadioButton.checked = true;
    }
}
于 2015-10-16T12:47:36.123 回答